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

Home -> Community -> Usenet -> c.d.o.misc -> Re: PLSQL /Enumeration

Re: PLSQL /Enumeration

From: Mark D Powell <mark.powell_at_eds.com>
Date: 17 May 2002 07:09:08 -0700
Message-ID: <178d2795.0205170609.3275d47e@posting.google.com>


Kevin Robinson <kevin.s.robinson_at_bt.com> wrote in message news:<3CE4B352.FFF1457D_at_bt.com>...
> Does anyone know if its possible to do the following in PLSQL.
>
> IF var1 IN ( a , b , c , d)
> THEN
> etc.
>
>
> Thanks
>
> Kevin

Kevin, that is a pretty simple question to answer for yourself once you become familar with plsql. Here is some sample code that may help you out:

UT1> declare
  2 --

  3  v_var1      varchar2(1) := 'B';
  4  v_var2      varchar2(1) := 'G';

  5 --
  6 begin
  7 if v_var1 in ('A','B','C') then
  8 dbms_output.put_line('Value '||v_var1||' is in list');   9 else
 10 dbms_output.put_line('Value '||v_var1||' is NOT in list');  11 end if;
 12 if v_var2 in ('A','B','C') then
 13 dbms_output.put_line('Value '||v_var2||' is in list');  14 else
 15 dbms_output.put_line('Value '||v_var2||' is NOT in list');  16 end if;
 17 end;
 18 /
Value B is in list
Value G is NOT in list

PL/SQL procedure successfully completed.

HTH -- Mark D Powell -- Received on Fri May 17 2002 - 09:09:08 CDT

Original text of this message

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