Data Management

Mini-Tip #2 - NVL2()

NVL2 is a neat little SQL function that I think is underused. It seems to me it could have a better name.

The

format is NVL2(expr1, expr2, expr3). What it does is if expr1 is NULL,

it returns expr3. If expr1 is NOT NULL, it returns expr2.

An IF statement to do the same would look like:

IF expr1 IS NULL
THEN
  expr3
ELSE
  expr2
END IF

Read the rest of this post.


Editor's Picks