I am the Co-Founder of The Data Monk. I have a total of 6+ years of analytics experience
3+ years at Mu Sigma
2 years at OYO
1 year and counting at The Data Monk
I am an active trader and a logically sarcastic idiot :)
Follow Me
The NVL() function lets you return an alternative value when an expression iS NULL.
The syntax is NVL(expr1,expr2).
Example:
SELECT ProductName, UnitPrice * (UnitsInStock + NVL(UnitsOnOrder, 0))
FROM Products;
The above query will return 0 when UnitsOnOrder is NULL.
The NVL function allows you to replace null values with a default value. If the value in the first parameter is null, the function returns the value in the second parameter.
e.g- select id, nvl(col_1, 0)
Whenever the col_1 is null, it will return its value as 0
Answers ( 2 )
The NVL() function lets you return an alternative value when an expression iS NULL.
The syntax is NVL(expr1,expr2).
Example:
SELECT ProductName, UnitPrice * (UnitsInStock + NVL(UnitsOnOrder, 0))
FROM Products;
The above query will return 0 when UnitsOnOrder is NULL.
.
The NVL function allows you to replace null values with a default value. If the value in the first parameter is null, the function returns the value in the second parameter.
e.g- select id, nvl(col_1, 0)
Whenever the col_1 is null, it will return its value as 0