Tuesday, July 31, 2007

Oracle Tips - PL/SQL Cursor For Loop

Oracle Tips - PL/SQL Cursor For Loop: "The CURSOR FOR is a very efficient cursor. Lines 2 through 6 define the cursor. Line 8 handles opening the cursor, fetching the rows, testing for new rows, and exiting when a new row is not returned. Notice that the record r_c8 is not defined in the declaration section. The CURSOR FOR automatically defines r_c8 as a c8%rowtype. The scope for r_c8 is only inside the CURSOR FOR loop. Likewise, the cursor attributes for cursor c8 are defined only inside the CURSOR FOR loop. "