Total PageViews

Thursday, December 12, 2019

Compare two arguments in oracle through "NULLIF" function


Oracle NULLIF() function accepts two arguments. It returns a null value if both arguments are equal. In case the arguments are not equal, the NULLIF() function returns the first argument.

For E.g:-

Condition 1:- If Expression 1 and Expression 2 are the same then it will return the NULL value.

Query:- SELECT NULLIF('Database Dynasty', 'Database Dynasty') as CheckArgument 
               FROM dual;
O/P:- Null

Condition 2:- If Expression 1 and Expression 2 are different then it will return the first argument.

Query :- SELECT NULLIF('Database', 'Database Dynasty') as CheckArgument 
               FROM dual;
O/P:- Database



What other ideas can you add to this post that I may have not mentioned?

No comments:

Post a Comment