Thursday, 14 February 2013

NVL to COALESCE

Recently had to transform an Oracle SQL Query into a Standard SQL Query. One of the three steps to take was changing the NVL into a COALESCE.

NVL is a Oracle specific function[1].

A simple "search & replace" did the trick.


COALESCE requires the same data types, where NVL does not.

References

Oracle NVL
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions105.htm
Stackoverflow - Oracle differences between nvl and coalesce
http://stackoverflow.com/questions/950084/oracle-differences-between-nvl-and-coalesce

1 comment: