CREATE OR REPLACE TYPE APP_ROW AS OBJECT
( ID VARCHAR2(100 BYTE)
, NAME VARCHAR2(100 CHAR)
, AGE NUMBER
)
CREATE OR REPLACE TYPE APP_TABLE AS TABLE OF APP_ROW;
CREATE OR REPLACE FUNCTION FNC_USER (IN_JOB IN VARCHAR) RETURN APP_TABLE
IS
V_ROW APP_TABLE;
BEGIN
SELECT APP_ROW(T.ID, T.NAME, T.AGE)
BULK COLLECT INTO V_ROW
FROM TABLE_NAME T
WHERE T.JOB = IN_JOB;
RETURN V_ROW;
END;
SELECT *
FROM TABLE(FNC_TABLE('SALES'));