If you're really desperate, put a <<LABEL>> and a NULL; before your END
LOOP statement, then GOTO
1 begin
2 for counter in 1..10 loop
3 dbms_output.put_line(counter);
4 goto brk1;
5 dbms_output.put_line('didnt branch');
6 <<brk1>>
7 null;
8 end loop;
9* end;
SQL> /
1
2
3
4
5
6
7
8
9
10
In article <93eat6$2oa$1_at_nnrp1.deja.com>,
Thorsten Kettner <thorsten_kettner_at_my-deja.com> wrote:
> 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/
>
Sent via Deja.com
http://www.deja.com/
Received on Tue Jan 09 2001 - 11:36:00 CST