• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic