Preamble
Oracle/PLSQL NVL2 function extends the functionality of the NVL function. It replaces the value when a Null value is encountered and also when a non-Null value is encountered.
Oracle/PLSQL syntax of NVL2 function
NVL2( string1_id, value_if_NOT_null_id, value_if_null_id )
Parameters & arguments of NVL2
- string1_id – line to check for Null value.
- value_if_NOT_null_id – this value is returned if string1 has no Null value.
- value_if_null_id – this value is returned if string1 has a Null value.
NVL2 function in the following versions of Oracle/PLSQL
|
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
|
Let’s consider some examples of Oracle NVL2 function and learn how to use NVL2 function in Oracle PLSQL.
SELECT NVL2(suppl_city, 'Completed', 'n/a')
FROM suppls;
The SQL query will return ‘n/a’ if the suppl_city field contains a null value. Otherwise, it will be the ‘Completed’ value.
Another example of using the NVL2 function in Oracle/PLSQL:
SELECT suppl_id,
NVL2(suppl_desc, suppl_name, suppl_name2)
FROM suppls;
This SQL query will return suppl_name2 if suppl_desc contains a Null value. Otherwise, it will return the suppl_name field.
NVL2 FUNCTION IN ORACLE SQL WITH EXAMPLE
About Enteros
Enteros offers a patented database performance management SaaS platform. It proactively identifies root causes of complex business-impacting database scalability and performance issues across a growing number of clouds, RDBMS, NoSQL, and machine learning database platforms.
The views expressed on this blog are those of the author and do not necessarily reflect the opinions of Enteros Inc. This blog may contain links to the content of third-party sites. By providing such links, Enteros Inc. does not adopt, guarantee, approve, or endorse the information, views, or products available on such sites.
Are you interested in writing for Enteros’ Blog? Please send us a pitch!
RELATED POSTS
How to Optimize Retail Sector Growth with Enteros Cloud FinOps, RevOps Efficiency, Cost Attribution, Cost Estimation, and AI SQL
- 9 April 2026
- Database Performance Management
Introduction The retail sector is undergoing a rapid transformation driven by eCommerce expansion, omnichannel experiences, AI-powered personalization, and data-driven decision-making. Retailers today operate across multiple platforms—online stores, mobile apps, physical outlets, and global marketplaces—creating highly complex and data-intensive environments. As retail businesses scale, they face a critical challenge:how to drive growth while controlling costs, optimizing … Continue reading “How to Optimize Retail Sector Growth with Enteros Cloud FinOps, RevOps Efficiency, Cost Attribution, Cost Estimation, and AI SQL”
How to Optimize Healthcare Growth Management with Enteros Database Performance and AIOps Platform
Introduction The healthcare sector is rapidly evolving with the adoption of digital technologies such as electronic health records (EHRs), telemedicine, AI-driven diagnostics, and real-time patient monitoring. These innovations are transforming how healthcare providers deliver services, improve patient outcomes, and manage operations. However, as healthcare organizations scale, they face a critical challenge:how to manage growth efficiently … Continue reading “How to Optimize Healthcare Growth Management with Enteros Database Performance and AIOps Platform”
How to Drive eCommerce Revenue Growth with Enteros Growth Management, RevOps Efficiency, and Cloud FinOps
- 8 April 2026
- Database Performance Management
Introduction The eCommerce sector has witnessed explosive growth over the past decade, fueled by digital transformation, mobile shopping, AI-driven personalization, and global online marketplaces. From startups to enterprise retailers, businesses are scaling rapidly to meet rising customer expectations for speed, convenience, and seamless experiences. However, this rapid growth introduces a critical challenge:how to increase revenue … Continue reading “How to Drive eCommerce Revenue Growth with Enteros Growth Management, RevOps Efficiency, and Cloud FinOps”
How to Drive Healthcare Sector Performance Growth with Enteros Database Management and AI SQL Optimization
Introduction The healthcare sector is undergoing a significant digital transformation driven by electronic health records (EHRs), telemedicine, AI-powered diagnostics, and real-time patient monitoring systems. Healthcare organizations are increasingly relying on data to deliver better patient outcomes, improve operational efficiency, and ensure regulatory compliance. However, with the exponential growth of healthcare data comes a major challenge:how … Continue reading “How to Drive Healthcare Sector Performance Growth with Enteros Database Management and AI SQL Optimization”