Re: Using SQL IN predicate in PL/SQL
From: Terje Tysse <diltert_at_NOSPAMhotmail.com>
Date: Thu, 28 Feb 2002 19:30:35 GMT
Message-ID: <i41t7u8mn8e4p13a0ubdkqdbn91ombi68u_at_4ax.com>
END ; In SQL*Plus :
Date: Thu, 28 Feb 2002 19:30:35 GMT
Message-ID: <i41t7u8mn8e4p13a0ubdkqdbn91ombi68u_at_4ax.com>
On Thu, 28 Feb 2002 11:36:53 -0500, "R Chin" <rchin_at_panix.com> wrote:
>In PL/SQL I have constructed a variable (called v_Pool) with the value
>('ABC','DEF','GHI') to be used in the where clause of dynamic sql
>
>
>The following code does not work...please help
>
>if v_test IN v_Pool then
>........;
>end if;
>
You could try with INSTR. Ex :
PROCEDURE test
IS
v_pool VARCHAR2(20) := '(''ABC'',''DEF'')' ; v_test VARCHAR2(3) := 'ABC' ; BEGIN IF INSTR ( v_pool , v_test ) > 0 THEN dbms_output.put_line ( 'Yes' ) ; ELSE dbms_output.put_line ( 'No' ) ; END IF ;
END ; In SQL*Plus :
C012HOME:orcl>exec test ;
Yes
Regards,
Terje Tysse
Received on Thu Feb 28 2002 - 20:30:35 CET