1

在 Oracle 10g 中,没有 continue 语句。通常,它在显式游标中被模仿,如下所示:

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

鉴于在 cursor-for-loop 语法中 LOOP 关键字紧跟在 cursor 之后,如何模仿 continue 语句?

FOR rec IN c_cur LOOP
    ...
END LOOP ;
4

2 回答 2

2
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 ;
于 2013-08-23T23:50:09.807 回答
-1

利用CONTINUE

FOR rec IN c_cur LOOP
    IF condition = 10 THEN
        CONTINUE;
    END IF ;
END LOOP ;
于 2013-08-24T11:05:23.620 回答