Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Using Variable IN Clause
Hi
Why is everyone obessed with solving this problem using IN, resulting in some weird and wonderful solutions.
There's a simple answer - use INSTR
Check_String = '*MOTHER*FATHER*GRANDMOTHER*GRANDFATHER*';
SELECT name
FROM relatives
WHERE instr(Check_String,'*'||relative_type||'*') <> 0
Note the use of asterisks to delimit the column
and the individual values in the variable. This is
so that only complete values are compared.
i.e. FATHER is not found in GRANDFATHER
If an asterisk could be part of a valid value
then use some other character which could not
be as a delimiter.
John
Tel: (702) 498 4990
Fax: (702) 871 4318
e-mail: jomarlen_at_aol.com
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. Inc.
and/or its employees.
![]() |
![]() |