AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
SQL NVL Function |
|
SQL > SQL NULL >
NVL Function
The NVL( ) function is available in Oracle, and not in MySQL or SQL Server. This 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. Oracle's NVL(expression, replacement) replaces any NULL value with the specified replacement, leaving non-NULL values unchanged. Use NVL when writing Oracle SQL; use IFNULL for MySQL or ISNULL for SQL Server.
For example, if we have the following table, Table Sales_Data
The following SQL,
would generate result below:
This is because NULL has been replaced by 100 via the NVL function, hence the sum of the 3 rows is 300 + 100 + 150 = 550. Frequently Asked QuestionsQ: What does the SQL NVL function do? Q: Which databases support NVL? Q: What is the difference between NVL and NVL2 in Oracle? Q: How does NVL compare to COALESCE?
|
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.