Question

In Oracle 10g, there is no continue statement. Typically it is mimicked in an explicit cursor like such:

OPEN c_cur ;
<<cont>>
LOOP
    ...
    IF condition = 10 THEN
        GOTO cont ;
    END IF;
END LOOP;
CLOSE c_cur ;

Given that the LOOP keyword immediately follows the cursor in the cursor-for-loop syntax, how can a continue statement be mimicked?

FOR rec IN c_cur LOOP
    ...
END LOOP ;
Was it helpful?

Solution

FOR rec IN c_cur LOOP
    ...
    IF condition = 10 THEN
        GOTO cont ;
    END IF ;

<<CONT>>
NULL; -- END cannot be immediately preceeded by a <<marker>>

END LOOP ;

OTHER TIPS

use CONTINUE

FOR rec IN c_cur LOOP
    IF condition = 10 THEN
        CONTINUE;
    END IF ;
END LOOP ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top