Skip to content
Advertisement

Concatenate with string but exclude when null

Oracle v11

Exclude a string in a Concat when the value is NULL?

Work Query:

TableA

Output I’m getting

Expected Output:

Advertisement

Answer

Something like this… I added simulated inputs to test all four possibilities. However, note that if you may have last name but no first name, and also first name but no last name, the combined column will show just one name but you will not know if it is first or last. (Also, when a comma is added, I also add a space after the comma, as is usual; that can be controlled easily though.)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement