Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: How pass vals list for "select where in ()"
two silly ugly, higher-cost (?) indirect ways :
create table TMP (NAME ...)
insert into TMP values (...)
select * from emp where name in (SELECT NAME from TMP)
2) a better way : unsing LIKE instead of IN :
select * from emp where ','||ParamVar||',' like '%,'||name||',%'
-- ================================= Sylvain Brun -- Société INFOLOGIC - Services et conseils en Informatique - Tél. 04 75 82 16 40 - Fax. 04 75 82 16 38 ================================= Jon Doe <Fake.Address_at_Fake.com> a écrit dans le message : NERa6.4635$165.317946_at_newsread2.prod.itd.earthlink.net...Received on Mon Jan 22 2001 - 07:03:21 CST
> Hi,
> I think what I'm trying to do is simple. All I want to do is to be able
to
> pass a list of values as a parameter into my stored procedure so that I
can
> do something like:
>
> select * from emp where name in (paramVar)
> - in place of -
> select * from emp where name in ('a','b','c')
>
> Needless to say, the whole point of this is that list size will be dynamic
> and unknown before the proc is called. Passing a simple varchar2 of comma
> delimited values of course does not work.
>
> Any idea?
> Thanks!
>
>