Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Passing an "in" string to a Stored Procedure

Re: Passing an "in" string to a Stored Procedure

From: Jomarlen <jomarlen_at_aol.com>
Date: 14 Apr 1998 16:32:14 GMT
Message-ID: <1998041416325700.MAA26394@ladder01.news.aol.com>


>> 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



John C. Lennon
Utility Partners Inc.
Las Vegas

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US