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

Home -> Community -> Usenet -> c.d.o.tools -> Re: CONTINUE loop

Re: CONTINUE loop

From: Thorsten Kettner <thorsten_kettner_at_my-deja.com>
Date: Tue, 09 Jan 2001 06:25:45 GMT
Message-ID: <93eat6$2oa$1@nnrp1.deja.com>

Hi Walter, thank you for your advice. The problem is that my program is much more complicated than my simple example. There are several places where I want to branch to the next loop. If I use IFs my code will get nested deeper and deeper and will be much worse to read. This is why other languages offer a CONTINUE command. I guess there is none available in PL/SQL, right?



In article <3A59FAC7.FCF0859E_at_Unforgetable.com>,   Walter T Rejuney <BlueSax_at_Unforgetable.com> wrote:
> Thorsten Kettner wrote:
> >
> > Hi, I am rather new with PL/SQL and wonder if there isn't a CONTINUE
> > statement like in other languages, to skip statements in a loop and
> > continue with the next iteration. Please look at my very simple
 example
> > to clearify what I mean. I use GOTO and a lable instead and even
 need a
> > dummy command to be allowed to use the lable at the end of the loop:
> >
> > FOR lrec_emp IN curs_emp LOOP
> > {some processing for any employee}
> > IF lrec_order.dept_id <> ln_dept_id THEN
> > GOTO NextEmp;
> > END IF;
> > {some processing for employees of the given departement}
> > <<NextEmp>>
> > ln_dummy := ln_dummy;
> > END LOOP;
> >
> > Sent via Deja.com
> > http://www.deja.com/
>

> You just need to rethink your code:
>

> for lrec_emp in curs_emp LOOP
> ---processing for all employees
> if lrec_order.dep_id = ln_dept_id then
> --processing for employees of given department--
> end if
> ln_dummy := ln_dummy
> end loop;

>

Sent via Deja.com
http://www.deja.com/ Received on Tue Jan 09 2001 - 00:25:45 CST

Original text of this message

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