Using Cursors
Use a cursor in an application program to retrieve multiple rows from a table or from a result set returned by a stored procedure. This sections looks at how an application program can use a cursor to retrieve rows from a table.
When the SELECT statement associated with the cursor is executed, a set of rows is retrieved. The set of rows returned is referred to as the result table or result set. In an application program, there needs to be a way to retrieve one row at a time from the result set into host variables. A cursor performs that function. A program can have several cursors, open at the same time.
DECLARE Cursor
To define and identify a set of rows to be accessed with a cursor, issue a DECLARE CURSOR statement. The DECLARE ...
Get DB2® Universal Database™ for OS/390™ v7.1 Application Certification Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.