Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Stored Procedures - Newbie Questions
Hi,
I have been working with Oracle server for about 8 months and I have been experimenting with stored procedures. I wanted to find out about the procedure that I am using, it opens a cursor and I was wondering if the cursor is automatically closed when the package is ended? Is there a better way to do this? I have pasted the example that I have been using below.
Thanks in advance for your answer
Sean
CREATE OR REPLACE PACKAGE employees_orcl
AS
TYPE empcur IS REF CURSOR;
PROCEDURE GetEmpRecords(indeptno IN NUMBER, p_cursor OUT empcur,
p_errorcode OUT NUMBER);
END employees_orcl;
/
CREATE OR REPLACE PACKAGE BODY employees_orcl
AS
PROCEDURE GetEmpRecords(indeptno IN NUMBER,
p_cursor OUT empcur,
p_errorcode OUT NUMBER)
IS
BEGIN
p_errorcode := 0;
OPEN p_cursor FOR SELECT * FROM emp WHERE deptno = indeptno ORDER BY
empno;
EXCEPTION
WHEN OTHERS THEN
p_errorcode := SQLCODE;
END GetEmpRecords;
END employees_orcl;
/
Received on Mon Dec 03 2001 - 01:21:57 CST
![]() |
![]() |