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
Governing AI Performance in Technology Enterprises: Enteros GenAI-Driven Intelligence Platform
- 26 January 2026
- Database Performance Management
Introduction Artificial Intelligence has moved from experimentation to the core of modern technology enterprises. AI now powers customer experiences, revenue optimization, fraud detection, personalization engines, autonomous operations, developer productivity tools, and mission-critical decision systems. From SaaS platforms and digital marketplaces to enterprise software and AI-native startups, organizations are embedding AI into nearly every layer of … Continue reading “Governing AI Performance in Technology Enterprises: Enteros GenAI-Driven Intelligence Platform”
Optimizing Healthcare Databases at Scale: How Enteros Aligns GenAI, Performance Intelligence, and Cloud FinOps
Introduction Healthcare organizations are under unprecedented pressure to deliver better patient outcomes while operating within increasingly constrained financial and regulatory environments. Hospitals, payer networks, life sciences companies, and digital health platforms now rely on massive volumes of data—electronic health records (EHRs), imaging repositories, genomics pipelines, AI-driven diagnostics, claims systems, and real-time patient monitoring platforms. At … Continue reading “Optimizing Healthcare Databases at Scale: How Enteros Aligns GenAI, Performance Intelligence, and Cloud FinOps”
Governing Cloud Economics at Scale: Enteros Cost Attribution and FinOps Intelligence for BFSI and Technology Organizations
- 25 January 2026
- Database Performance Management
Introduction Cloud adoption has become foundational for both BFSI institutions and technology-driven enterprises. Banks, insurers, fintechs, SaaS providers, and digital platforms now depend on cloud-native architectures to deliver real-time services, enable AI-driven innovation, ensure regulatory compliance, and scale globally. Yet as cloud usage accelerates, so does a critical challenge: governing cloud economics at scale. Despite … Continue reading “Governing Cloud Economics at Scale: Enteros Cost Attribution and FinOps Intelligence for BFSI and Technology Organizations”
Turning Telecom Performance into Revenue: Enteros Approach to Database Optimization and RevOps Efficiency
Introduction The telecom industry is operating in one of the most demanding digital environments in the world. Explosive data growth, 5G rollout, IoT expansion, cloud-native services, and digital customer channels have fundamentally transformed how telecom operators deliver services and generate revenue. Behind every call, data session, billing transaction, service activation, roaming event, and customer interaction … Continue reading “Turning Telecom Performance into Revenue: Enteros Approach to Database Optimization and RevOps Efficiency”