Oracle NULLIF Function


/ Published in: SQL
Save to your folder(s)

A few examples of the NULLIF function.


Copy this code and paste it in your HTML
  1. --Example 1
  2.  
  3. SELECT NULLIF(23, 23) AS NULLCHECK FROM dual;
  4.  
  5.  
  6. --Example 2
  7. SELECT NULLIF(23, 29) AS NULLCHECK FROM dual;
  8.  
  9. --Example 3
  10. SELECT NULLIF(23.000, 23) AS NULLCHECK FROM dual;
  11.  
  12. --Example 4
  13. SELECT NULLIF('Sunday', 'Sunday') AS NULLCHECK FROM dual;
  14.  
  15. --Example 5
  16. SELECT NULLIF('Sunday', 'Saturday') AS NULLCHECK FROM dual;
  17.  
  18. --Example 6
  19. SELECT NULLIF('23.7', 23.7) AS NULLCHECK FROM dual;
  20.  
  21. --Example 7
  22. SELECT NULLIF(SYSDATE, 'Someday') AS NULLCHECK FROM dual;
  23.  
  24. --Example 8
  25. SELECT NULLIF(NULL, 'Sunday') AS NULLCHECK FROM dual;
  26.  
  27. --Example 9
  28. SELECT NULLIF('Sunday', NULL) AS NULLCHECK FROM dual;

URL: http://www.databasestar.com/oracle-nullif/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.