This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 29219
    
135

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: 29219
    
135

General SQL questions go in the JDBC forum (at the top of the forum list.) I'll move this there for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this possible?
 
Similar Threads
SQL Select to concat rows
Oracle Interview Questions
EJBQL Question
prepared statement with "in" predicate
what is the right way to load this object graph. real world problem