``++NVL++`` was introduced by Oracle Database during the 80's. ``++COALESCE++`` is a more modern function part of ANSI-92 standard than can replace ``++NVL++``. Use of ``++COALESCE++`` should be preferred to ``++NVL++`` for performance reason if the two parameters provided have the same type. COALESCE is running faster than NVL thanks to its short-circuit evaluation of the parameters.

In order to avoid "ORA-00932: inconsistent datatypes" error, double-check the two arguments of the NVL function have the same type before switching to COALESCE.


== Noncompliant Code Example

[source,sql]
----
SELECT employee_uuid, NVL(TO_CHAR(bonus_pct), 'not this year') "Bonus" FROM employees
----


== Compliant Solution

[source,sql]
----
SELECT employee_uuid, COALESCE(TO_CHAR(bonus_pct), 'not this year') "Bonus" FROM employees
----



ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
