Oracle NVL2 Function Explained

The NVL2() function in Oracle database is used to return different results based on a given condition. It takes three parameters: the first parameter is an expression or column, the second parameter is the value returned when the first parameter is not null, and the third parameter is the value returned when the first parameter is null.

The grammar is as follows:

NVL2(expr1, expr2, expr3)

If expr1 is not null, return expr2. If expr1 is null, return expr3. This function can be used to return different results based on conditions in a query.

bannerAds