1. nvl (expr1, expr2) If exp1 is null, exp2 is returned; otherwise expr1 is returned; 2. nvl2 (expr1, expr2, expr3) If exp1 is null, expr3 is returned, otherwise, expr2; 3, coalesce (expr [, expr1]...) is returned. the first non-null value in the returned parameter; withtestas (selectc11col_1, col_2, c31col_3fro
1. nvl (expr1, expr2) If exp1 is null, exp2 is returned; otherwise expr1 is returned; 2. nvl2 (expr1, expr2, expr3) If exp1 is null, expr3 is returned, otherwise, expr2; 3, coalesce (expr [, expr1]...) is returned. the first non-null value in the returned parameter; with test as (select 'c11' col_1, ''col_2, 'c31' col_3 fro
1. nvl (expr1, expr2)
If exp1 is a null value, exp2 is returned; otherwise, expr1 is returned;
2. nvl2 (expr1, expr2, expr3)
If exp1 is null, expr3 is returned; otherwise, expr2 is returned;
3. coalesce (expr [, expr1]...)
The first non-null value in the returned parameter;
With test
(Select 'c11' col_1, ''col_2, 'c31' col_3 from dual union all
Select ''col_1, 'c21' col_2, 'c32' col_3 from dual union all
Select 'c13 'col_1, 'c22' col_2, ''col_3 from dual union all
Select ''col_1, 'c23' col_2, 'c33' col_3 from dual union all
Select 'c14' col_1, ''col_2, 'c34' col_3 from dual union all
Select 'c15' col_1, ''col_2,'' col_3 from dual
)
Select col_1, nvl (col_1, col_1) exp_1,
Col_2, nvl2 (col_2, col_2 | ',', 'is null') exp_2,
Col_3, coalesce (col_1, col_2, col_3) exp_3
From test;
COL_1 EXP_1 COL_2 EXP_2 COL_3 EXP_3
--------------------------------------
C11 c11 is null c31 c11
C21 c21, c32 c21
C13 c13 c22 c22, c13
C23 c23, c33 c23
C14 c14 is null c34 c14
C15 c15 is null c15
6 rows selected