Live ORACLE

if you are Oracle Developer ,than this Blog most likely will make you happy.

About my Blog

This Blog particularized for Oracle Developers ... you will see interesting Codes for SQL , PL/SQL as well as new ideas for Developer Suite and Client Tools that will help you in your professional life ... and I hope I reach for your satisfaction.

About Me

I'm Hany Freedom , 25 years old , I live in EL-Minia City in Egypt , I'm Moderator at ArabOUG.org the best Arabic Forum for ORACLE on the Net. if you interested to know more about me .... just Click Here.

Returning a Record from a Function


DECLARE

TYPE EMPRECTYP IS RECORD(EMP_ID NUMBER(6),

SALARY NUMBER(8,2));

CURSOR DESC_SALARY RETURN EMPRECTYP IS

SELECT EMPLOYEE_ID,

SALARY

FROM EMPLOYEES

ORDER BY SALARY DESC;

EMP_REC EMPRECTYP;

FUNCTION NTH_HIGHEST_SALARY

(N INTEGER)

RETURN EMPRECTYP

IS

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;

BEGIN

NULL;

END;

/


Share/Save/Bookmark

0 comments:

Post a Comment



Newer Posts Older Posts Home Page
 
http://www.dpriver.com/images/sqlpp-banner-2.png

Thanks for reading my Blog ... you Visitor Number :-