Q
Problem solve Get help with specific problems with your technologies, process and projects.

Figuring out the compilation errors in a stored procedure

I'm struggling to write a stored procedure or function that returns a recordset. Below is my SQL, which SQLplus declares as having compilation errors. Please help.

 CREATE TABLE TDepartment 
 (department_id NUMERIC(5)
        CONSTRAINT pk_TDepartment PRIMARY KEY,
 department_name VARCHAR(30),
 department_description VARCHAR(50));
  
 create or replace package TRUSTS_ADMIN as 
 type TDEPARTMENT_CURSOR is ref cursor return
 TDEPARTMENT%ROWTYPE; 
 end TRUSTS_ADMIN;
  
 create or replace function GET_ALL_DEPARTMENTS
 return
 TRUSTS_ADMIN.TDEPARTMENT_CURSOR is 
  		rc TRUSTS_ADMIN.TDEPARTMENT_CURSOR; 
 begin 
 open rc for select * from TDEPARTMENT; 
 return rc; 
 end; 

It is hard to say which error you are receiving. To see your error, type SHOW ERRORS after you try to compile a function. This will tell you *exactly* what the problem is.

For More Information


Dig Deeper on Oracle database design and architecture

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataManagement

SearchBusinessAnalytics

SearchSAP

SearchSQLServer

TheServerSide.com

SearchDataCenter

SearchContentManagement

SearchHRSoftware

Close