Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How do you call a function that belongs in a package?

843845Mar 8 2011 — edited Mar 8 2011
Hello,

Can anyone help me with this issue? My intent is to create a procedure that returns a cursor to the results of the query without passing in the cursor to the function. After reading thru online tutorials, I found that I had to create a function, not a procedure.

I created a .sql file as such:

-----------
create or replace package GetEmployeeCursors is
type empResultSet is REF CURSOR;
function Funct1 return empResultSet;
end GetEmployeeCursors;
/

create or replace package body GetEmployeeCursors is function Funct1 return
empResultSet is
tmpResultSet empResultSet;
begin
open tmpResultSet for
select * from employee;
return tmpResultSet;
end Funct1;
end GetEmployeeCursors;
/

-----------

Both the package and package body were created without any problems.
Then, I tried to call the Funct1() in many ways, including the following:

call System.getEmployeeCursors.Funct1()
call getEmployeeCursors.Funct1()
call Funct1()

All produced the following error message:
ERROR at line 1:
ORA-06576: not a valid function or procedure name

How do I call Funct1()?

Thanks so much in advance,
--Anna
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 5 2011
Added on Mar 8 2011
5 comments
3,883 views