Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

not exists sql to find non matching rows

2960347Aug 17 2015 — edited Aug 17 2015

Hi All ,

I am want optimize the sql where i have to find the column(join of two column) present in one table(tab1) but not in other(tab2). I tried something like this but it is showing me zero rows.

SELECT COL1||COL2

FROM TAB1 e

where NOT  exists

(

select 1 from TAB2 rd

join TAB1 e on e.COL1||e.COL2=RD.COL1||RD.COL2

)

When i use the simple sql(which takes hell lot of time) i am getting correct output:0

SELECT COL1||COL2

FROM TAB1 e

where COL1||COL2 not in

(

select COL1||COL2 from TAB2 rd

)

What is wrong in 'NOT EXISTS' query,or suggest me better way to achieve same. Thanks!

This post has been answered by Karthick2003 on Aug 17 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 14 2015
Added on Aug 17 2015
2 comments
830 views