File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Is this possible?" Watch "Is this possible?" New topic

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

Joined: May 26, 2003
Posts: 30085

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

Joined: May 26, 2003
Posts: 30085

General SQL questions go in the JDBC forum (at the top of the forum list.) I'll move this there for you.
It is sorta covered in the JavaRanch Style Guide.
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