Home » SQL & PL/SQL » SQL & PL/SQL » Looking for a proper search term
Looking for a proper search term [message #294124] Wed, 16 January 2008 09:43 Go to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
I want to search for a DB/2 equivalent for this construct:
where (col1, col2) in ((val1, val2), (val3, val4))

so, the comparison on multiple columns at a time.
Does anybody know the name of this construct? I can't find a proper search-term.
Re: Looking for a proper search term [message #294128 is a reply to message #294124] Wed, 16 January 2008 09:52 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
I think the term you are looking for is pairwise
Re: Looking for a proper search term [message #294134 is a reply to message #294124] Wed, 16 January 2008 10:20 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
And this is a valid syntax in Oracle:
SQL>select * from emp where (empno,deptno) in ((7839,10),(7698,30));

EMPNO ENAME JOB        MGR HIREDATE  SAL COMM DEPTNO 
 7698 BLAKE MANAGER   7839 01/05/81 2850    -     30 
 7839 KING  PRESIDENT    - 17/11/81 5000    -     10 

Regards
Michel
Re: Looking for a proper search term [message #294170 is a reply to message #294134] Wed, 16 January 2008 11:33 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Sorry Michel, missing your point.
Of course I know it is valid syntax, why else would I mention it.
I need to do the same in a DB/2 database(or find something equivalent that works both in DB/2 and Oracle).
Re: Looking for a proper search term [message #294174 is a reply to message #294170] Wed, 16 January 2008 12:02 Go to previous messageGo to next message
Michel Cadot
Messages: 68718
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Sorry Frank, I misunderstood your question, I thought you said the opposite: this works in DB2 and you wanted to know how to do it in Oracle.

Regards
Michel
Re: Looking for a proper search term [message #294177 is a reply to message #294124] Wed, 16 January 2008 12:21 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9100
Registered: November 2002
Location: California, USA
Senior Member
Oracle refers to this as a "multi-column in-list" in some of their examples:

http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/qradv.htm#sthref901

But, that may not be what they call it in DB2 and there may not be a comparable method. I don't know DB2.

Re: Looking for a proper search term [message #294179 is a reply to message #294124] Wed, 16 January 2008 12:35 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9100
Registered: November 2002
Location: California, USA
Senior Member
Apparently, db2 calls it an "in predicate":


http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db2.doc.sqlref/rinpred.htm
Re: Looking for a proper search term [message #294187 is a reply to message #294179] Wed, 16 January 2008 14:07 Go to previous message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Thanks pablolee, Michel and Barbara!
I just got word from my friend that he found something similar in DB/2 thanks to your responses here.
Previous Topic: Populate A Table Prior to Select
Next Topic: Bind Variable Name to Cursor
Goto Forum:
  


Current Time: Mon Dec 02 08:24:23 CST 2024