Skip to content

Instantly share code, notes, and snippets.

@maccath
Created February 14, 2013 16:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maccath/4953904 to your computer and use it in GitHub Desktop.
Save maccath/4953904 to your computer and use it in GitHub Desktop.
Examples for the usage of Oracle/PLSQL's NVL() function for substitution of NULL values
# ORACLE/PLSQL - NVL(A, B) EXAMPLES
# If A IS NULL substitute with B
# Example 1. if table b contains values that over-write values in table a
SELECT NVL(b.name, a.name) AS name FROM a left join b on a.id = b.id;
# Example 2. to replace NULL values with an alternative placeholder value
SELECT NVL(a.name, 'Unnamed') AS name FROM a;
@nigerdyanes
Copy link

Gracias!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment