Dynamic SQL IN clause
431995Oct 29 2004 — edited Oct 31 2004Hi,
I suspect this has been asked and answered many times but my feeble search attempts on the OTN site returned too many seemingly fruitless results. After wading through 10 pages I decided to just post the question, hoping that someone knows the answer or at least a link.
Platform is SUN; Oracle 8; C++; Pro*C
I would like to use a dynamic SQL statement that has a dynamic IN clause, eg:
SELECT ORDERKEY
FROM ORDERS
WHERE STATE IN (:STATELIST)
Since the number of input arguments is variable, this falls into type 4, but I have found no samples that suggest how this is supported. If it cannot (using an in clause, which I suppose I could replace with a parenthesized set or OR clauses), fine. If it can, all the better.
I would appreciate, a short description, or a link, or (best of all, of course) a sample using Pro*C.
If its not supported and anyone has suggestions other than the grouped OR clauses, I'd appreciate hearing those also. If the answer to this is in a FAQ, I apologize and respectfully request a link to it.
Thanks,
Bill