Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> How Do I execute this from SQL PLUS?
Hi, All
I've got a real quick question?
How do I exec this:
CREATE OR REPLACE PACKAGE emp_actions AS
TYPE EmpRecTyp IS RECORD (emp_id INTEGER, salary
REAL);
CURSOR desc_salary RETURN EmpRecTyp;
FUNCTION nth_highest_salary (n INTEGER) RETURN
EmpRecTyp;
END emp_actions;
/
CREATE OR REPLACE PACKAGE BODY emp_actions AS
CURSOR desc_salary RETURN EmpRecTyp
IS
SELECT empno, sal
FROM emp
ORDER BY sal DESC;
FUNCTION nth_highest_salary (n INTEGER) RETURN
EmpRecTyp
IS
emp_rec EmpRecTyp;
BEGIN
OPEN desc_salary;
FOR i IN 1..n LOOP
FETCH desc_salary INTO emp_rec;
END LOOP;
CLOSE desc_salary;
RETURN emp_rec;
END nth_highest_salary;
END emp_actions;
/