Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Where Clauses: IN versus =

Where Clauses: IN versus =

From: Tim Marshall <TIMMY!_at_PurplePandaChasers.Moertherium>
Date: Mon, 12 Sep 2005 13:01:14 -0230
Message-ID: <dg4702$3u7$1@coranto.ucs.mun.ca>


I'm writing a lot of code in a various apps to construct strings which are Oracle SQL statements.

I'm wondering if there is a performance hit with the use of in() versus equals. I know for multiple criteria that, for example:

     Where FK_Whatever in (123, 124, 16, 4)

is preferable to:

     Where FK_Whatever = 123 or FK_Whatever = 124 or FK_Whatever = 16 or FK_Whatever = 4

But what about when I have a single criteria? Is:

     Where FK_Whatever = 123

faster/preferable to

   Where FK_Whatever in (123)?

The reason I ask is because it is much easier to simply write the code to construct an in() rather than test to see how many criteria there are. I can and have done the latter for years, but wonder if I am just wasting my efforts.

Any comment is appreciated, thanks very much in advance.

-- 
Tim    http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto  "TIM-MAY!!" - Me
Received on Mon Sep 12 2005 - 10:31:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US