Some DBMSs have an NVL2()
function that allows us to replace a value with another value, the new value being determined by whether or not the initial value is null.
It’s similar to the NVL()
function, except that NVL2()
accepts exactly three arguments. This allows us to specify a different value to return in the event the first argument is not null.
In contrast, with the NVL()
function, some DBMSs accept only two arguments (which makes the function a synonym for the IFNULL()
function) while others accept an unlimited number of arguments (which makes it a synonym for the COALESCE()
function).
Continue reading →