First page Back Continue Last page Image

Loading multiple fields in one Fetch

1) The Declaration

DECLARE cursor_name CURSOR FOR select_statement;

2) Create Error Handler for missing Target

DECLARE CONTINUE HANDLER FOR NOT FOUND handler_statement;

3) Initiate Cursor Use

OPEN cursor_name;

4) Load the Cursor

FETCH cursor_name INTO variable1, variable2, variable3;

5) Release the Cursor

CLOSE cursor_name;

You can set up a query container that can load an entire record at a time or part of a record, when you do you need something to define what you are fetching for the container, this is called a Cursor

A cursor has 5 parts as follows