Download PL/SQL User's Guide and Reference

Transcript
Cursor Attributes
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO my_ename, my_empno, my_sal;
EXIT WHEN (c1%ROWCOUNT > 5) OR (c1%NOTFOUND);
INSERT INTO temp VALUES (my_sal, my_empno, my_ename);
COMMIT;
END LOOP;
CLOSE c1;
END;
In the final example, you use %ROWCOUNT to raise an exception if an unexpectedly
high number of rows is deleted:
DELETE FROM accts WHERE status = ’BAD DEBT’;
IF SQL%ROWCOUNT > 10 THEN
RAISE out_of_bounds;
END IF;
Related Topics
Cursors, Cursor Variables
PL/SQL Language Elements
13-47