OPEN

Top  Previous  Next

 

Syntax

<open_cursor> ::=

  OPEN cursor_name;

 

Open the cursor identified by cursor_name so you can FETCH data with it.

 

Example

In the example below, you can see the cursor "mycursor" being declared with a SELECT-statement selecting a single column from a table and applying an ordering.

 

execute udsblock()

returns(out_int integer)

as

declare mycursor cursor for (select v from DUMMY_ROWS_10 order by v desc);

begin

  /* open the cursor result set */

  open mycursor;

 

  /* fetch data from the first row */

  fetch mycursor into out_int;

 

  /* close the cursor */

  close mycursor;

end