Restrictions on GOTO

0
Restrictions on GOTO:


  • It is illegal to branch into an inner block, loop, or IF statement.
  • “GOTO” cannot navigate from the EXCEPTION selection to any other section of the PL/SQL block.
  • “GOTO” cannot reference a LABLE in a nested block.
  • “GOTO” cannot be executed outside an “IF” clause to LABLE inside “IF” clause.
  • It is better to have a limited usage of “GOTO” in programming block.
  • “GOTO” cannot navigate from the EXCEPTION selection to any other section of the PL/SQL block.

SQL>DECLARE
    n NUMBER:=10;
    BEGIN
        GOTO l_innerblock;
        IF n>20 THEN
        <<l_innerblock>>
        INSERT INTO dept VALUES(50,’SW’,’HYD’);
        END IF;
    END;

SQL>BEGIN
        GOTO l_innerblock;
    BEGIN
    <<l_innerblock>>
    INSERT INTO dept VALUES(50,’SW’,’HYD’);
    END;
    END;


 Click here to go to Back page

About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts