If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > IN operator

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-04, 15:29
ljordan ljordan is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
IN operator

Does anyone know if there is a limit on the amounts of items in the IN operator in an sql statement

eg.
where a in ('a','ad',......................)

Thanks
Reply With Quote
  #2 (permalink)  
Old 03-03-04, 02:17
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
What I've found on the Oracle Metalink:
Quote:
</8.1.7 Docu>
An expression list can contain up to 1000 expressions.
</8.1.7 Docu>

In addition to this, there might be other limitations to be respected, e.g. SQL*PLUS has documented limits like "command-line length" (=2500 characters) and "number of lines per SQL command" (=500 (assuming 80 characters per line)).

Hope this helps,

Christoph Pfrommer
Oracle Consulting Germany
I also hope this helps
Reply With Quote
  #3 (permalink)  
Old 03-03-04, 08:34
ljordan ljordan is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
Smile

Thank you. :-)
Reply With Quote
  #4 (permalink)  
Old 03-03-04, 08:41
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
If you are adding so many values to your IN that the limit concerns you, maybe you should be considering a different approach anyway? Like perhaps storing the values in a global temporary table which you then join to the query.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #5 (permalink)  
Old 03-03-04, 09:09
ljordan ljordan is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
I am calling a pl/sql function in powerbuilder to get this list and passing it back to a powerbuilder event. Im not sure the powerbuilder session will be able to see the values created in the table by the pl/sql function as it will be a different session.
There will probably be from 1 - 80 values in the IN. Is 80 an acceptable number of values for an IN?

Thanks for your help.
Reply With Quote
  #6 (permalink)  
Old 03-03-04, 09:40
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Well it isn't as high as I feared it might be. Hopefully you will be using bind variables? Even with bind variables, there will still be up to 80 variants of the SQL statement parsed, but that's better than one per execution if the query is used a lot.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On