Here is an example of a function on Oracle. Then given following is a procedure that called the function. I have used them to implement the paging function. Here is the Function. create or replace FUNCTION "RETURN_EMPLOYEE" (argEmailAddress IN EMPLOYEE.EmailAddress%TYPE) return EMPLOYEE_NESTED_TABLE as V_RET EMPLOYEE_NESTED_TABLE; CURSOR C1 IS SELECT EMPLOYEE.EMPLOYEEId, EMPLOYEE.Name, EMPLOYEE.Stake, EMPLOYEE.CreatedDate, EMPLOYEE.StartDate, EMPLOYEE.EndDate, EMPLOYEE.EMPLOYEEDurationId, EMPLOYEEMember.EMPLOYEEMemberStatusId, EMPLOYEEMember.UPDATENOTIFIED FROM EMPLOYEE,EMPLOYEEMember WHERE EMPLOYEEMember.EmailAddress = argEmailAddress AND EMPLOYEE.EMPLOYEEId = EMPLOYEEMember.EMPLOYEEId AND EMPLOYEEMember.EMPLOYEEMemberStatusId IN(2,5,6) ORDER BY EMPLOYEEId; i NUMBER := 0; begin V_RET := EMPLOYEE_NESTED_TABLE (); FOR C1_REC IN C1 LOOP i := i + 1; ...