Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Stored Procedures - Newbie Questions

Stored Procedures - Newbie Questions

From: Neo <SeanK_at_NOSPAMpacific.net.au>
Date: Mon, 3 Dec 2001 18:21:57 +1100
Message-ID: <tJFO7.130$ko4.13235@nasal.pacific.net.au>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US