CREATE OR REPLACE PROCEDURE GetEmployeesInDept( c OUT SYS_REFCURSOR)
I am having a query related to the above Stored Procedures,
That is while defining the cursor we mentioned it as sys_refcursor, and in some, web site I have seen it as REF CURSOR as shown
create or replace procedure GetEmployeesInDept( c out ref cursor)
Please tell me what is the difference between the ref cursor and sys_refcursor.
I’m not sure what you mean by
I’ve not seen this before and I can’t get a procedure declared like this to compile. Could you please provide sample code or links to where you’ve seen this before?
What you might have seen is something like the following:
In this case, we declare a type to be a
REF CURSOR, and use it as anOUTparameter in a stored procedure.There is no difference between using a type declared as
REF CURSORand usingSYS_REFCURSOR, becauseSYS_REFCURSORis defined in theSTANDARDpackage as aREF CURSORin the same way that we declared the typeref_cursor. In fact, if you’re using Oracle 9i or later, look within your Oracle database installation, in%ORACLE_HOME%\rdbms\admin\stdspec.sql, and you should find the following line somewhere in there:SYS_REFCURSORwas introduced in Oracle 9i. You may find various types declared asREF CURSORin PL/SQL code that was written before Oracle 9i was released.