Good Morning friends today we will discuss about the concept of COALESCE in ORACLE..
COALESCE returns the first non-null expr in the expression list. You must specify at least two expressions. If all occurrences of expr evaluate to null, then the function returns null.
Syntax: COALESCE (expr1, expr2);
This is equivalent to
CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END;
Example 1:
Select COALESCE (1*2,3+4) FROM DUAL;
Output 1 :
2
Example 2:
Select COALESCE (NULL,3+4) FROM DUAL;
Output 2:
7
Thankyou...!!!!
COALESCE returns the first non-null expr in the expression list. You must specify at least two expressions. If all occurrences of expr evaluate to null, then the function returns null.
Syntax: COALESCE (expr1, expr2);
This is equivalent to
CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END;
Example 1:
Select COALESCE (1*2,3+4) FROM DUAL;
Output 1 :
2
Example 2:
Select COALESCE (NULL,3+4) FROM DUAL;
Output 2:
7
Thankyou...!!!!
No comments:
Post a Comment