Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing an "in" string to a Stored Procedure
>> I have a stored procedure that I would like to pass a parameter to
>that<BR>
>> contains a list of numbers to be used as part of an "IN" for the Where<BR>
>> clause.<BR>
><BR>
>> SELECT * FROM table<BR>
>> WHERE id IN ( idlist)<BR>
><BR>
>> idlist would be a string such as "1,2,3,4"<BR>
><BR>
One solution might be
WHERE instr(idlist,','||to_char(id)||',') <> 0
Note both leading and trailing commas to avoid finding partial strings. This just means your string needs to be ",1,2,3,4," or you could use WHERE instr(idlist ','||idlist||',',','||to_char(id)||',') <> 0
John
John
Web Site: http://members.aol.com/jomarlen/
The views expressed in this message
are those of the author and not
necessarily those of U.P.
and/or its employees.
Received on Tue Apr 14 1998 - 11:32:14 CDT