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: CASE strucrure in PL/SQL

Re: CASE strucrure in PL/SQL

From: Connor McDonald <connor_mcdonald_at_yahoo.com>
Date: Fri, 06 Jun 2003 18:51:05 +0800
Message-ID: <3EE07219.7E66@yahoo.com>


Sybrand Bakker wrote:
>
> On Thu, 05 Jun 2003 21:18:11 +0000, W.Breitling
> <member28455_at_dbforums.com> wrote:
>
> >
> >ora92.scott> DECLARE
> > 2 v_department_id number;
> > 3 BEGIN
> > 4 FOR i IN 1..7 LOOP
> > 5 select case when i=1 then 10
> > 6 else case when i=2 then 20
> > 7 else case when i=3 then 30
> > 8 else case when i=4 then 40
> > 9 else case when i=5 then 50
> > 10 else case when i=6 then 60
> > 11 else case when i=7 then 70
> > 12 end end end end end end end
> > 13 into v_department_id
> > 14 from dual;
> > 15 dbms_output.put_line(i||' - '||v_department_id);
> > 16 end loop;
> > 17 end;
> > 18 /
> >1 - 10
> >2 - 20
> >3 - 30
> >4 - 40
> >5 - 50
> >6 - 60
> >7 - 70
> >
> >PL/SQL procedure successfully completed.
>
> Why hardcoding this crap if you can put it in one pl/sql table and
> forget about it. Is no one learning appropiate coding techniques
> anymore? Looks like
>
> Sybrand Bakker, Senior Oracle DBA
>
> To reply remove -verwijderdit from my e-mail address

true, but with case you could have a complex expression in the 'when' component, something you can't do with a plsql lookup table

hth
connor

-- 
=========================
Connor McDonald
http://www.oracledba.co.uk

"Some days you're the pigeon, some days you're the statue"
Received on Fri Jun 06 2003 - 05:51:05 CDT

Original text of this message

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