Avatar of sam2929
sam2929
 asked on

Pick not null names

How can i do this.


Name1 Name2 Name3  Name4

ABC          CDE    BBB

                                          KKK

                            MBC        LLL


So pick UP First non null name staring from Name 1,2,3,4

Final name
ABC
KKK
MBC
Oracle Database

Avatar of undefined
Last Comment
awking00

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Peter Chan

Use
...
where nvl(Name1,'')<>'' or nvl(Name2,'')<>'' ...

Open in new window

slightwv (䄆 Netminder)

HuaMinChen,

Your post doesn't make sense.

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck