Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Stored Procedure and WHERE IN statement.
Tim wrote:
> Hi, I have a stored procedure where I'm trying to pass in the string
> "11761, 13870, 11762, 13053, 12845" of numbers (P_Dept_Id) into a
> WHERE IN statment.
>
> The IN statement treats P_Dept_Id as a string rather than individual
> integers which my goal is. Can somebody tell me what I'm doing wrong
> here?
>
>
> ...
>
> P_Dept_Id IN VARCHAR2,
>
> ...
>
> --Doesn't work
> SELECT Section_Id FROM Section
> WHERE Parent_Id in (P_Dept_Id)
>
> --DOES work
> SELECT Section_Id FROM Section
> WHERE Parent_Id in (11761, 13870, 11762, 13053, 12845)
Follow Michel's advice ... the answer involves using multiset. http://www.psoug.org/reference/cast.html
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Mon Jun 28 2004 - 20:53:56 CDT