Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to return cursor ?
Tolik,
Here are examples of how to use a cursor variable. There is a package header, procedure, a test script, and the ddl for the table. Hope this helps.
Rob Calfee
CREATE OR REPLACE
procedure open_query(cur_junk out jk.junk_curtype) is
junk_cur jk.junk_curtype;
begin open junk_cur for select * from junk; cur_junk := junk_cur;
--TEST SCRIPT
junk_rec junk%rowtype;
curjunk jk.junk_curtype;
begin
open_query(curjunk);
loop
fetch curjunk into junk_rec;
exit when curjunk%notfound; dbms_output.put_line(junk_rec.num1 || ' ... ' || junk_rec.num2);end loop;
end;
.
/
CREATE TABLE junk
(
num1 NUMBER(2), num2 NUMBER(2)
INITIAL 102400 NEXT 151552 PCTINCREASE 1 MINEXTENTS 1 MAXEXTENTS 249
On Wed, 22 Sep 1999 17:33:23 +0300, "Tolik K." <tol2000_at_geocities.com> wrote:
>How can i return cursor from PL/SQL function in the package ? >PLEASE TELL ME HOW TO CORRECT THIS CODE TO RETURN CURSOR > >CREATE OR REPLACE PACKAGE BODY reports IS > > FUNCTION rep_book_sell_days(date_begin IN DATE, date_end IN DATE) > RETURN ????? IS > CURSOR rep_book_sell_days_cursor(date_beg DATE, date_e DATE) IS > SELECT ...................... > BEGIN > RETURN rep_book_sell_days_cursor(date_begin, date_end); ?????? > END rep_book_sell_days; > >END reports; > >-- >________________________ >Tolik. >e-mail: tol2000_at_geocities.com > >
Rob Calfee
DBA
rcalfee_at_incsystem.com
Received on Wed Sep 22 1999 - 10:12:08 CDT
![]() |
![]() |