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
Messages: 3
Registered: July 2007
Junior Member
select distinct cardnum from transactions where lanenum in('K01', K02');

Oracle version: Oracle 8i(

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.

Re: SQL IN function question. [message #259947 is a reply to message #259946] Thu, 16 August 2007 22:13 Go to previous message
Messages: 25578
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: Validations in interface in Oracle Apps 11i (merged)
Next Topic: Table Creating from Oracle/PHP HTML
Goto Forum:

Current Time: Wed Aug 23 05:15:40 CDT 2017

Total time taken to generate the page: 0.01904 seconds