Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: what is the SQL equivalent of 'continue' and 'break' in C ?
Scott wrote:
> happyardy_at_gmail.com wrote:
> > what is the SQL equivalent of 'continue' and 'break' in C ?
> >
> > like can I do this...
> >
> >
> > for counter in 1..10
> > if(something something)
> > ( if (something)
> > ( if(something)
> > then continue;
> >
> > //Rest of the for loop
> >
> > end loop;
> >
> > Would it start the next iteration without processing the rest of the
> > loop ?
> >
> > thanks
> > - Ardy
>
>
>
> loop
> if something
> then
> exit; -- continue, i.e. go on with the rest of the main loop
> end if;
>
>
Scott,
I am a little confused about if this works the way, 'continue' works in
C language. I mean in the middle of a for loop if I have a "continue;"
in C language, the control just goes to the top of the loop and starts
a new iteration.
In your code here, 'exit'' would break me out of the inner loop and the
control would go to first statement(if any) that is outside the inner
loop. I have a bunch of statements in my code after the inner loop.
What I want to happen is that the control goes directly to the next
iteration without trying to execute any of the remaining code outside
of the inner loop..
Your code would hold good if it is the last piece of code in my outer
loop(for loop). That means it would be good if as soon as my inner loop
ends, my outer loop ends too.
Not saying that your code is wrong but your code will go down and execute my remaining statements after the inner loop though I dont want it to. If I wanted to do that then I wouldnt want a 'continue' like working, now would I ?
Please let me know if I am not understanding correctly and have
misinterpreted anything.
thanks & regards
![]() |
![]() |