• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

In clause in oracle

 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In clause in oracle takes 1000 parameter maximum.
If we give more than that then it is giving exception.

I do not want to use select query inside the IN clause.
Actually I am calling one method. to which I am passing String Array of 1500 PK that I want to use in IN clause.that I am doing by FOR loop and appending to query.
but I do not want change signature of my method.

Please tell us alternative solution.

Thanks in advance.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of Oracle DB are you using?
"I do not want to use select query inside the IN clause"
Any specific reason of not wanting to use such a solution?

If it's version 11, then based on the information you've provided an alternative solution is to use a select query inside the IN clause as follows:

Assuming the current sql query you have is as follows:
select * from tableA where columnA in(<array of string>);

The above can be modified to
A type "string_type" can be defined as a table of varchar2 in the Oracle DB.
Then the array of string can be assigned to the type variable "string_type_var".
select * from tableA where columnA in(select column_value from table(:string_type_var));

The above solution is efficient and clean.
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replay Sridher.
I got it.
 
Space pants. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic