NULLIF:
Example : SELECT NULLIF(1,2)
O/P : 1
In the above syntax, the first argument can not be null. Then it will return 1
Example : SELECT NULLIF(null,1)
O/P : Error
The above query throws error because the first argument is null. The first argument can not be null.
Example : SEELCT NULLIF(2,2)
O/P : null
In the above query, it will return null value because, the arguments should not be equal. The argument should be different.
- It will accept only two parameters.
- If both are not equal then it will return first value.
Example : SELECT NULLIF(1,2)
O/P : 1
In the above syntax, the first argument can not be null. Then it will return 1
Example : SELECT NULLIF(null,1)
O/P : Error
The above query throws error because the first argument is null. The first argument can not be null.
Example : SEELCT NULLIF(2,2)
O/P : null
In the above query, it will return null value because, the arguments should not be equal. The argument should be different.
No comments :
Post a Comment