CLOSE

Top  Previous  Next

 

Syntax

<close_cursor> ::=

  CLOSE cursor_name;

 

Close the cursor and free up resources.

 

Example

In the example below, you can see the cursor "mycursor" used to fetch all data and break away when there's no more data available. The cursor is closed afterward.

 

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;

 

  while true

  do begin

       fetch mycursor into out_int;

       if (row_count > 0)

       then suspend;

       else break;

     end;

 

  /* close the cursor */

  close mycursor;

end