What is the usage method of “continue” in Oracle?

In Oracle, there is no equivalent of the ‘continue’ keyword found in other programming languages. In PL/SQL, you can achieve a similar effect using IF statements or GOTO statements.

For example, you can use an IF statement to skip a portion of code block.

FOR i IN 1..10 LOOP
    IF i = 5 THEN
        CONTINUE;
    END IF;
    
    DBMS_OUTPUT.PUT_LINE(i);
END LOOP;

In addition, you can also use the GOTO statement to achieve the functionality of continue.

FOR i IN 1..10 LOOP
    IF i = 5 THEN
        GOTO skip;
    END IF;
    
    DBMS_OUTPUT.PUT_LINE(i);
    
    <<skip>>
END LOOP;

It is important to note that using GOTO statements can make the code difficult to understand and maintain, so it is recommended to avoid using them as much as possible.

bannerAds