Static cursors v15
Rather than executing a whole query at once, you can set up a cursor that encapsulates the query and then read the query result set one row at a time. This approach allows you to create SPL program logic that retrieves a row from the result set, does some processing on the data in that row, and then retrieves the next row and repeats the process.
Cursors are most often used in the context of a
WHILE loop. Include a conditional test in the SPL logic that detects when the end of the result set was reached so the program can exit the loop.
declaring_a_cursor opening_a_cursor fetching_rows_from_a_cursor closing_a_cursor using_%_rowtype_with_cursors cursor_attributes cursor_for_loop parameterized_cursors