Restrictions on GOTO
0
Restrictions on GOTO:
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;
- 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;
0 comments: