Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic SQL IN clause

431995Oct 29 2004 — edited Oct 31 2004
Hi,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 28 2004
Added on Oct 29 2004
5 comments
325 views