Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

check at least one variable is not null inside where clause

User_B9XGOJul 25 2017 — edited Jul 25 2017

Hi All,

I have to check for 2 processes.

1st process -- all the parameters are NULL

2nd process -- all the parameters are mandatory

If at least one parameter is not entered then it would error out saying "Enter all the three parameters".

--My code

IF

lv_eno IS NULL and lv_ename IS NULL and lv_sal IS NULL

THEN lv_status ='new'

ELSIF

lv_eno IS NOT  NULL and lv_ename IS NOT NULL and lv_sal IS NOT NULL

THEN lv_status = 'processed'

ELSE

dbms_output.put_line(" Enter all the three parameters");

xn_retcode := 2;

END IF:

This works for me but I need to use the 1st two conditions in my cursor also to filter the records.

If I use

IF LEAST(lv_eno,lv_ename,lv_sal) IS NULL

then ELSE conditions works but the 1st condition fails.

Can anyone help me with a simple code that I can use instead of the repeated NULL and NOT NULL conditions

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2017
Added on Jul 25 2017
18 comments
3,708 views