How to use the Oracle NVL function

Have you ever seen yourself in a situation where you end up building a giant query, doing UNIONs with other queries (and, as we talked about in another article on UNIONS, you need to have the same amount of attributes / expressions in the two queries so that the result and you end up finding null records that would not be interesting to present as nulls (on screen, panel, or report).

To resolve this, we can use the Oracle NVL function that has the following syntax:
NVL (string1, replace_with)
Representing in the example cited: NVL (column_name, 0);
That is, anything that is null in this column, change to “0”;

That’s it folks, I hope I have helped. Having any questions, please contact us.

Strong hug.

Eduardo Santana
bufallos@bufallos.com.br

Leave a Reply

Your email address will not be published. Required fields are marked *