The NVL() function is used to replace NULL value with another value. It is similar to the IFNULL Function in MySQL and the ISNULL Function in SQL Server.
store_name Sales Store A 300 Store B NULL Store C 150
SELECT SUM(NVL(Sales,100)) FROM Sales_Data;
It returns 550. This is because NULL has been replaced by 100 via the ISNULL function, hence the sum of the 3 rows is 300 + 100 + 150 = 550.
Pravin MorePosted Nov 23, 2011, 5:18 AM
NVL() function is used to specify how we want to treat with NULL values in sql.
for.e.g:-
SELECT Name,NVL(Amount,0)) FROM TableName
so above will return 0 when Amount is Null.
its same like ISNULL() and COALESCE()
Thanks,
Pravin.
Satyapriya NayakPosted Nov 23, 2011, 5:11 AM
The NVL() function is used to replace NULL value with another value. It is similar to the IFNULL Function in MySQL and the ISNULL Function in SQL Server.
store_name Sales
Store A 300
Store B NULL
Store C 150
SELECT SUM(NVL(Sales,100)) FROM Sales_Data;
It returns 550. This is because NULL has been replaced by 100 via the ISNULL function, hence the sum of the 3 rows is 300 + 100 + 150 = 550.
Thanks