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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

package and function

user543623Mar 19 2012 — edited Mar 19 2012
1.
create or replace package emp_ac as
type emprectyp is record(empid int, salaryy int);
cursor cc return emprectyp;
FUNCTION nth_highest_salary (n INT) RETURN EmpRecTyp;
end emp_ac;

2. create or replace package body emp_ac as
cursor cc return emprectyp is
select idd, salary from emp;

FUNCTION nth_highest_salary (n INT) RETURN EmpRecTyp IS
emp_rec emprectyp;
BEGIN
OPEN cc;
FOR i IN 1..n LOOP
FETCH cc INTO emp_rec;
END LOOP;
dbms_output.put_line('ff');

CLOSE cc;
RETURN emp_rec;
END nth_highest_salary;
end emp_ac;

3. I want to call the package and function. How do i do it?
declare
type highest is record();
begin
highest := emp_ac.nth_highest_salary(2);
dbms_output.put_line('ff');
end;



I get error :ORA-06550: line 2, column 24:
PLS-00103: Encountered the symbol ")" when expecting one of the following:

<an identifier> <a double-quoted delimited-identifier>
current delete exists prior


Please advise.

Thanks.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 16 2012
Added on Mar 19 2012
4 comments
111 views