NULLIF:
- The NULLIF function can be thought as null-if-equals function.
- It compares two expressions. If they are equal server returns a null and If they not equal [or] if the second expression is null, the first expression is returned.
- Both the compared expressions shall be source values.
NULLIF(22,22)
-------------
SELECT NULLIF(22,23)FROM DUAL;
NULLIF(22,23)
-------------
22
SELECT NULLIF(22,NULL)FROM DUAL;
NULLIF(22,NULL)
---------------
22
SELECT NULLIF(NULL,NULL)FROM DUAL;
--IS WRONG
-------------
SELECT NULLIF(22,23)FROM DUAL;
NULLIF(22,23)
-------------
22
SELECT NULLIF(22,NULL)FROM DUAL;
NULLIF(22,NULL)
---------------
22
SELECT NULLIF(NULL,NULL)FROM DUAL;
--IS WRONG
No comments:
Post a Comment