This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Is this possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Is this possible?" Watch "Is this possible?" New topic
Author

Is this possible?

Sabarish Sasidharan
Ranch Hand

Joined: Aug 29, 2002
Posts: 73
This is not an oracle specific question. This is more a SQL question. Did not find another suitable forum for this. So posting here.

select * from xxx where (xxx.a, xxx.b) = ('20', '30')

is a working SQL.

Does anyone know how this SQL should be modified to work with the IN operator and possibly with multiple values

Ideally i want to do something like this
select * from xxx where (xxx.a, xxx.b) in (('20','30'), ('30', '40'))


Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

Sabarish,
You can do the same thing with the union operator:

This approach has the advantage of being portable across databases.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30136
    
150

General SQL questions go in the JDBC forum (at the top of the forum list.) I'll move this there for you.
 
Consider Paul's rocket mass heater.
 
subject: Is this possible?
 
Similar Threads
prepared statement with "in" predicate
EJBQL Question
what is the right way to load this object graph. real world problem
Oracle Interview Questions
SQL Select to concat rows