Created
February 14, 2013 16:19
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gracias!