There is 3 way to
use records (with cursor)
1 - creating cursor
and fetching it into record
FETCH vc_MyCursor INTO vr_RecEmployees;
At the cursor
should be closed as
CLOSE vc_MyCursor;
2 - using record as cursor of select statement in for loop
Simple you can
create a local record in for loop as
FOR rec IN (SELECT * FROM employees e WHERE department_id = 30) LOOP
...
END LOOP;
3 - using record based on cursor in for loop!
Another easier way to create a local record is
using created cusrsor in for loop as
FOR rec IN vc_MyCursor LOOP
...
END LOOP;
All codes are
available in GitHub here.
If you want to
check some real project with all PLSQL codes please check here
Till next time!
Comments
Post a Comment