Home » Open Source » Programming Interfaces » SQL IN function question.
SQL IN function question. [message #259946] Thu, 16 August 2007 22:01 Go to next message
aspectweaver
Messages: 3
Registered: July 2007
Junior Member
select distinct cardnum from transactions where lanenum in('K01', K02');


Oracle version: Oracle 8i(8.1.7.0)

In the transactions table, each row of the table is a transaction with an associated cardnumber. Therefore there can be multiple instances of the same card number in the table. I am using php to access the database and I was wondering if there was any way to dynamically add arguments to the IN clause because the number of lanes I want to search in won't be the same every time.


Cheers
Re: SQL IN function question. [message #259947 is a reply to message #259946] Thu, 16 August 2007 22:13 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
This is really a PHP programming question & the SQL would be valid going against many/most RDBMS.
I really am not sure exactly what you are asking.
You'll have logic in your code that is either some sort of loop or ("large") nested IF tree to build the contents of the IN list.
I did something like this using PERL.
I had a loop where I'd add "ITEM," as needed.
After the loop terminated, I appended onto the string "DUMMY)"; where DUMMY was a value that I knew would never be matched.
Previous Topic: Oracle.DataAccess.Client.OracleErrorCollection in ODP .Net
Next Topic: Validations in interface in Oracle Apps 11i (merged)
Goto Forum:
  


Current Time: Fri Mar 29 07:37:59 CDT 2024