Fetching from a cursor variable.

From: Martin Jensen <mj_at_dde.dk>
Date: 1996/01/24
Message-ID: <4e4svr$cp0_at_berta.dde.dk>#1/1


Hi there.

I thought the PLSQL 2.2 from Oracle7 7.2.2.3 would allow me not only to declare variables of a cursor type but also to fetch from it!

Can anyone see if I am doing something wrong here - or is this feature to be expected in a later release?

Running:
 Oracle7 Server Release 7.2.2.3.0 - Production Release  With the distributed, replication and parallel query options  PL/SQL Release 2.2.2.3.0 - Production

  create or replace procedure cursor_tst is     type Emp_Cursor_type is REF CURSOR return emp%rowtype;

    emps_cursor Emp_Cursor_type;
    emps emp%rowtype;

  begin
    open emps_cursor for select * from emp where job = 'MANAGER';     if emps_cursor%isopen then
      dbms_output.put_line('Is Open: True');     else
      dbms_output.put_line('Is Open: False');     end if;
    loop
      fetch emps_cursor into emps;
-- Here I get error:

  • PLS-00992: Cursor Variables cannot be FETCH'ed from exit when emps_cursor%notfound; dbms_output.put_line(to_char(emps_cursor%rowcount)||': no '|| to_char(emps.empno)||' with name: '||emps.ename); end loop; end cursor_tst;

Thanks in advance

Have a nice day - Martin Jensen Received on Wed Jan 24 1996 - 00:00:00 CET

Original text of this message