CREATE OR REPLACE TYPE three_ot AUTHID DEFINER IS OBJECT
(
element0 VARCHAR2 (200),
col1 VARCHAR2 (200),
col2 VARCHAR2 (200)
)
Type created.
CREATE OR REPLACE TYPE three_nt IS TABLE OF three_ot
Type created.
CREATE OR REPLACE FUNCTION data_for_you
RETURN SYS_REFCURSOR AUTHID DEFINER
IS
l_cursor SYS_REFCURSOR;
l_nt three_nt;
BEGIN
SELECT three_ot (TO_CHAR (employee_id), last_name, first_name)
BULK COLLECT INTO l_nt
FROM hr.employees;
OPEN l_cursor FOR SELECT * FROM TABLE (l_nt);
RETURN l_cursor;
END;
Function created.
DECLARE
l_cursor SYS_REFCURSOR := data_for_you ();
l_three three_ot;
element0 VARCHAR2 (200);
col1 VARCHAR2 (200);
col2 VARCHAR2 (200);
BEGIN
LOOP
FETCH l_cursor INTO element0, col1, col2;
EXIT WHEN l_cursor%NOTFOUND;
DBMS_OUTPUT.put_line (col1);
END LOOP;
CLOSE l_cursor;
END;
King
Kochhar
De Haan
Hunold
Ernst
Austin
Pataballa
Lorentz
Greenberg
Faviet
Chen
Sciarra
Urman
Popp
Raphaely
Khoo
Baida
Tobias
Himuro
Colmenares
Weiss
Fripp
Kaufling
Vollman
Mourgos
Nayer
Mikkilineni
Landry
Markle
Bissot
Atkinson
Marlow
Olson
Mallin
Rogers
Gee
Philtanker
Ladwig
Stiles
Seo
Patel
Rajs
Davies
Matos
Vargas
Russell
Partners
Errazuriz
Cambrault
Zlotkey
Tucker
Bernstein
Hall
Olsen
Cambrault
Tuvault
King
Sully
McEwen
Smith
Doran
Sewall
Vishney
Greene
Marvins
Lee
Ande
Banda
Ozer
Bloom
Fox
Smith
Bates
Kumar
Abel
Hutton
Taylor
Livingston
Grant
Johnson
Taylor
Fleaur
Sullivan
Geoni
Sarchand
Bull
Dellinger
Cabrio
Chung
Dilly
Gates
Perkins
Bell
Everett
McCain
Jones
Walsh
Feeney
OConnell
Grant
Whalen
Hartstein
Fay
Mavris
Baer
Higgins
Gietz