Oracle PL/SQL GOTO Example
The PL/SQL GOTO statement provides an unconditional transfer of control to a labeled statement or block within the same subprogram. While it allows for direct jumps in code execution, its use is generally discouraged in modern programming practices due to potential negative impacts on code readability, maintainability, and debugging.
Example:
x NUMBER := 1;
GOTO my_label;
DBMS_OUTPUT.PUT_LINE('This will not print');
<<my_label>>
DBMS_OUTPUT.PUT_LINE('GOTO jumped to this label');
END;
/
No comments