This Oracle tutorial explains how to use the CURSOR FOR LOOP in Oracle with syntax and examples.
You would use a CURSOR FOR LOOP when you want to fetch and process every record in a cursor. The CURSOR FOR LOOP will terminate when all of the records in the cursor have been fetched.
The syntax for the CURSOR FOR LOOP in Oracle/PLSQL is:
The index of the record.
The name of the cursor that you wish to fetch records from.
The statements of code to execute each pass through the CURSOR FOR LOOP.
Here is an example of a function that uses a CURSOR FOR LOOP:
In this example, we've created a cursor called c1. The CURSOR FOR Loop will terminate after all records have been fetched from the cursor c1.