Re: NOT EXISTS and NOT Operator
From: joel garry <joel-garry_at_home.com>
Date: Thu, 19 Jul 2012 08:59:50 -0700 (PDT)
Message-ID: <1125079b-39ff-4ab8-b4f2-6c8c546c049b_at_f8g2000pbf.googlegroups.com>
On Jul 19, 6:36 am, raja <dextersu..._at_gmail.com> wrote:
> Hi All,
>
> Can someone please help me on the below doubts in Oracle 8.1.7 :
> 1. How does NOT EXISTS and NOT Operator work in the below query. Its confusing, please explain me the functionality over here in detail?
> 2. since not exists is not recommended to be used and not operator too. please suggest me the list of methods that this query can be re-written to improve the query performance!!??
>
> select
> 'value1', value2
> from table2 t1
> where t1.col2 = 'X'
> and not exists
> (
> select null
> from table2 t2
> where
> t2.col3 <> 'Y'
> and t1.col1 = t2.col1
> );
>
> Thanks in Advance.
>
> With Regards,
> Raja.
Date: Thu, 19 Jul 2012 08:59:50 -0700 (PDT)
Message-ID: <1125079b-39ff-4ab8-b4f2-6c8c546c049b_at_f8g2000pbf.googlegroups.com>
On Jul 19, 6:36 am, raja <dextersu..._at_gmail.com> wrote:
> Hi All,
>
> Can someone please help me on the below doubts in Oracle 8.1.7 :
> 1. How does NOT EXISTS and NOT Operator work in the below query. Its confusing, please explain me the functionality over here in detail?
> 2. since not exists is not recommended to be used and not operator too. please suggest me the list of methods that this query can be re-written to improve the query performance!!??
>
> select
> 'value1', value2
> from table2 t1
> where t1.col2 = 'X'
> and not exists
> (
> select null
> from table2 t2
> where
> t2.col3 <> 'Y'
> and t1.col1 = t2.col1
> );
>
> Thanks in Advance.
>
> With Regards,
> Raja.
Please go to asktom.oracle.com and type NOT EXISTS in the search box. Who says it is not recommended?
jg
-- _at_home.com is bogus. There are legs in the tape market yet. http://www.theregister.co.uk/2012/07/19/oracle_sl150/Received on Thu Jul 19 2012 - 10:59:50 CDT