oracle - PLS-00221: 'C1'(cursor) is not a procedure or is undefined -
i creating package use jasper reports learnt need sys_refcursor
cannot seem able loop cursors:eg
create or replace package body fin_statement_spool procedure fin_main_spool(vacid in varchar2, vfromdate in date, vtodate in date,c1 out sys_refcursor,c2 out sys_refcursor) cramount number; dramount number; countcr number; countdr number; begin open c1 select .......; open c2 select ........; begin in c1--error here loop rnum := 0; cramount := 0; dramount := 0; countdr := 0; countcr := 0; ..........
isn't right way?
you appear have confused explicit cursors, e.g.:
declare cursor cur select dummy dual; begin rec in cur loop dbms_output.put_line(rec.dummy); end loop; end; /
with ref cursor - pointer open cursor.
you typically use ref cursor open cursor in db , pass calling app loop through.
the way have declared ref cursors out parameters , tried loop through them in same procedure not make sense - once have fetched record cursor, cannot re-fetch it.
if absolutely must loop through ref cursor, you'd use sort of syntax:
declare cur sys_refcursor; rec dual%rowtype; begin open cur select dummy dual; loop fetch cur rec; exit when cur%notfound; dbms_output.put_line(rec.dummy); end loop; end; /
but said, in general, wouldn't looping through ref cursors in db, you'd doing in calling code.
perhaps if updated question requirements you're trying fulfil, suggest better way of doing it.
Comments
Post a Comment