Fetching Across COMMITs Using ROWID
DECLARE
CURSOR c1 IS
SELECT last_name,
job_id,
rowid
FROM employees;
my_lastname employees.last_name%TYPE;
my_jobid employees.job_id%TYPE;
my_rowid UROWID;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO my_lastname,my_jobid,my_rowid;
EXIT WHEN c1%NOTFOUND;
UPDATE employees
SET salary = salary * 1.02
WHERE rowid = my_rowid;
-- this mimics WHERE CURRENT OF c1
COMMIT;
END LOOP;
CLOSE c1;
END;
/
0 comments:
Post a Comment