Using EXIT With a Label in a LOOP
DECLARE
v_employees employees%ROWTYPE; -- declare record variable
CURSOR c1 IS
SELECT *
FROM employees;
BEGIN
OPEN c1; -- open the cursor before fetching
-- An entire row is fetched into the v_employees record
<<outer_loop>>
FOR i IN 1.. 10 LOOP
-- process data here
FOR j IN 1.. 10 LOOP
FETCH c1 INTO v_employees;
EXIT WHEN c1%NOTFOUND;
-- process data here
END LOOP;
END LOOP outer_loop;
CLOSE c1;
END;
/
0 comments:
Post a Comment