Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Csv list variable passed to stored proc
Sure. Just change your cursor to:
PROCEDURE MyProc
(
IdList IN VARCHAR SelectCursor OUT SelectRefCursor)
TYPE refRS IS REF CURSOR;
SelectCursor varchar2(1000) := 'SELECT * ' || ' FROM MyTable ' || ' WHERE ID IN (' || IdList ||')';
IS
BEGIN
OPEN refRS FOR SelectCursor;
Fetch refRS into Cursor_Row;
EXCEPTION
WHEN OTHERS THEN
....
END MyProc;
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
Sent: Monday, October 07, 2002 12:54 PM
To: Multiple recipients of list ORACLE-L
List
Is it possible to pass a comma seperated list of variables to make up a portion of the in clause in a stored procedure
I have a list of variables IdList that looks like this (1,2,3,4,5,66,77,88,someothernumbers)
PROCEDURE MyProc
(
IdList IN VARCHAR SelectCursor OUT SelectRefCursor)
IS
BEGIN
OPEN SelectCursor FOR
SELECT * FROM MyTable WHERE ID IN ( IdList );
END MyProc;
thanks
bob
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Bob Metelsky
INET: bmetelsky_at_cps92.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Oct 07 2002 - 13:19:51 CDT
![]() |
![]() |