Oracle Join SQL

Greetings,

I have a select query in Oracle like the followings. The query brings up the matching records have both TBL1.col2 and TBL2.col2 not equal to null. But if the records have null values in both TBL1.col2 and TBL2.col2, it won't bring up the records. Is there any work aroud? I need to show them as well.

Select *
From TBL1 left join TBL2
on TBL1.col1=TBL2.col1 and TBL2.col2=TBL2.col2

Thanks.
mrongAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slightwv (䄆 Netminder) Commented:
Two ways I can think of:
... and nvl(TBL1.col2,'ziggy')=nvl(TBL2.col2,'ziggy')

Just pick a word that should NEVER appear in the column.
or

on TBL1.col1=TBL2.col1 and ( TBL1.col2=TBL2.col2 or (TBL1.col2 is null and TBL2.col2 is null))
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PortletPaulfreelancerCommented:
afraid I don't get it: what is the purpose of "and TBL2.col2=TBL2.col2" at all

is it a mistake? did you mean:

Select *
From TBL1 left join TBL2
on TBL1.col1=TBL2.col1 and TBL1.col2=TBL2.col2 ?

If so  I would suggest:

Select *
From TBL1 left join TBL2
on TBL1.col1=TBL2.col1 and ( TBL1.col2=TBL2.col2 )  or ( TBL1.col2 is null and TBL2.col2 is null ))
0
awking00Commented:
Can you provide some sample data with results that represent what you're seeing and what you would like it to be?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.