NVL2 Function
NVL2(ref_value, value1, value2) 

If ref_value is NULL (or zero length string) then value2 is returned
If ref_value is NOT NULL then value1 is returned

SELECT
  idx, ref_value,
  NVL(ref_value,idx) "NVL(ref_value,idx)",
  idx||' => '||NVL2(ref_value,'ODD','EVEN') value_type
FROM 
 (SELECT 
    level  idx,
    DECODE(MOD(level,2),0,NULL,level) ref_value
  FROM  DUAL
  CONNECT BY level < 11
 ) q_tab


  CASE and DECODE     COALESCE     Oracle Functions     12c Index     11g Index

Oracle registered trademark of Oracle Corporation.

Last Revised On: October, 11th, 2017

  351