open

SQL/PL

Open a cursor

Syntax

open_stmt:
          OPEN cursor_name

Description

The OPEN statement is used to open a cursor for subsequent fetching.

Example

declare gr_than_avg cursor for select * from acctmgr;    ...    open gr_than_avg;    get_next1: loop       fetch gr_than_avg into l_id, l_name, l_date, l_comm;       if not found then           leave get_next1;       end if;       if l_date >= lo_date and l_date <= hi_date then            set comm_sum = comm_sum + l_comm;           set comm_count = comm_count + 1;       end if;    end loop get_next1;    close gr_than_avg;

See Also

DECLARE CURSOR

CLOSE

FETCH