Oracle NVL Function

The NVL function allows you to replace null values with a default values. If the first parameter is null, the function returns the second parameter. If the first parameter has some value then always return the first value.

Note:= NVL function replaces the null value with the same type of data.

  • Syntax of the NVL() function:
NVL(elm1, elm2)

For example:= The NVL() function allow two arguments. If the elm1 is null, then NVL() function returns elm2. If elm1 is not null, then NVL() function returns elm1.

SELECT NVL ('VIKAS','PANDEY') AS COL1 FROM DUAL;
SELECT NVL ('VIKAS',NULL) AS COL1 FROM DUAL;
Preview
SELECT NVL (NULL, 'VIKAS') AS COL1 FROM DUAL;
SELECT NVL (NULL, NULL)AS COL1 FROM DUAL;

You might also like: