Thanks for the question, Bob.
Asked: December 23, 2004 - 2:02 pm UTC
Last updated: December 23, 2004 - 8:26 pm UTC
Version: 10.1.0
Viewed 1000+ times
You Asked
Is there an equivalent to the C 'continue' keyword in PL/SQL?
1: BEGIN
2: FOR c_indx IN 1 .. 10 LOOP
3: IF c_indx = 3 THEN
4: NULL; -- PL/SQL CONTINUE HERE
5: END IF;
6: DBMS_OUTPUT.PUT_LINE( c_indx );
7: END LOOP;
8: END;
If line 4 were replaced with a continue statement, it would skip all the lines until the END LOOP statement of the inner most loop were reached (i.e. line 7 in this example). Thus the above would print:
1
2
4
5
6
7
8
9
10
and Tom said...
ops$tkyte@ORA9IR2> begin
2 for x in ( select * from emp )
3 loop
4 if x.comm is null
5 then
6 goto end_of_loop;
7 end if;
8 dbms_output.put_line( 'Hey there ' );
9 <<end_of_loop>>
10 null;
11 end loop;
12 end;
13 /
Hey there
Hey there
Hey there
Hey there
PL/SQL procedure successfully completed.
goto being as "respected" as continue will do it....
Rating
(1 rating)
Is this answer out of date? If it is, please let us know via a Comment