NVL2() Function in Oracle

What is NVL2() function in Oracle?

  1. NVL2() is another way to handling NULL value in Oracle.
  2. It is advanced version of NVL function.
  3. NVL2() function have functionality to handle both NULL Values and NOT NULL Values in Oracle.

Syntax of NVL2() function in Oracle

nvl2(value_to_check,value_to_not_null,value_to_null);

In NVL2() function used three parameter first parameter check the value if it return not null values then second parameter executed if first parameter return null values then third parameter executed.

Example of NVL2() function in Oracle

SELECT NVL2('Javainhand Tutorial','found','Not Found') as nvl2_example FROM DUAL;
SELECT NVL2('','found','Not Found') as nvl2_example FROM DUAL;

That’s all for today, I think( NVL2() Function in Oracle) post will be helpful for you. If you like the post then share your view in the comment box.

Originally published at https://www.javainhand.com.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store