Re: IN comparison using PL/SQL?

From: Andrea Mattioli <amattioli_at_gedy.it>
Date: Thu, 17 Dec 1998 21:40:58 +0100
Message-ID: <36796C5A.DE99C093_at_gedy.it>


I use the following syntax:

TempStr := ',Tony,Adam,Andrew,';
Select * from Employee where Instr(TempStr,','||First_name||',') != 0;

Note you have to put a comma in front and at end of string to solve potentially
problems due to names contained in others, for example 'Phil' And 'Philip'.

I know it's very slow but it works.

Andrea Mattioli.

Steve Sherman wrote:

> Probably not what you are looking for, but you can populate a temp table
> with the "in list" entries, and access it with a subselect.... where
> first_name in (select first_name from temp_table)
>
> - steve
>
> Tony wrote:
>
> > Within a Stored procedure:
> >
> > Can someone please tell me how or if you can use a string variable in
> > an IN comparison
> > of a Where clause? The following statement will work:
> >
> > Select * from Employee where First_name in ('Tony','Mark','Steve');
> >
> > But when the contents are passes as a variable, it will not work, as
> > follows:
> >
> > TempStr := 'Tony','Mark','Steve'
> > Select * from Employee where First_name in (TempStr);
> >
> > If anyone has a work around, I would appreciate the help.
> >
> > Thanks, Tony
Received on Thu Dec 17 1998 - 21:40:58 CET

Original text of this message