First piece that is wrong is that NVL(name1,'') doesn't do anything. An empty string in Oracle is considered a null so what that says is that if name1 is null, return null.
Second:
Given the data provided, please explain how your post will produce the expected results posted of:
Final name
ABC
KKK
MBC
awking00
Coalesce was designed precisely for this kind of query. It simply says return the first non-null value reached (null if all values are null). You should close this question and award slightwv the points without delay.
Open in new window