Using a GOTO Statement to Branch an Enclosing Block
-- example with GOTO statement
DECLARE
v_last_name VARCHAR2(25);
v_emp_id NUMBER(6) := 120;
BEGIN
<<get_name>>
SELECT last_name
INTO v_last_name
FROM employees
WHERE employee_id = v_emp_id;
BEGIN
dbms_output.Put_line(v_last_name);
v_emp_id := v_emp_id + 5;
IF v_emp_id < 120 THEN
GOTO get_name; -- branch to enclosing block
END IF;
END;
END;
/
0 comments:
Post a Comment