Posted By

bbrumm on 03/08/17


Tagged

sql Oracle


Versions (?)

Oracle NANVL Function


 / Published in: SQL
 

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

A few examples of the NANVL function.

  1. CREATE TABLE nanvl_test (
  2. num_val NUMBER(10,3),
  3. f_val FLOAT(3),
  4. bf_val BINARY_FLOAT,
  5. bd_val BINARY_DOUBLE);
  6.  
  7. INSERT INTO nanvl_test (num_val, f_val, bf_val, bd_val)
  8. VALUES (123.456, 234.567, 987.654, 135.789);
  9.  
  10.  
  11. INSERT INTO nanvl_test (num_val, f_val, bf_val, bd_val)
  12. VALUES (0, 0, 'NaN', 'NaN');
  13.  
  14. SELECT num_val, f_val, bf_val, bd_val,
  15. NANVL(num_val, 9999) AS nan_num,
  16. NANVL(f_val, 9999) AS nan_f,
  17. NANVL(bf_val, 9999) AS nan_bf,
  18. NANVL(bd_val, 9999) AS nan_bd
  19. FROM nanvl_test;

Report this snippet  

You need to login to post a comment.