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

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL: How pass vals list for "select where in ()"

Re: PL/SQL: How pass vals list for "select where in ()"

From: Sylvain Brun <sbrun_at_infologic.fr>
Date: Mon, 22 Jan 2001 14:03:21 +0100
Message-ID: <94hasc$et9$1@s1.read.news.oleane.net>

two silly ugly, higher-cost (?) indirect ways :

  1. passing through a temporary created table containing your list of values :

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

> 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!
>
>
Received on Mon Jan 22 2001 - 07:03:21 CST

Original text of this message

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