1-- Return types
2CREATE TYPE t_tf_row AS OBJECT (
3 id NUMBER,
4 description VARCHAR2(50)
5);
6CREATE TYPE t_tf_tab IS TABLE OF t_tf_row;
7-- Build a pipelined table function.
8CREATE OR REPLACE FUNCTION get_tab_ptf (p_rows IN NUMBER)
9 RETURN t_tf_tab PIPELINED AS
10BEGIN
11 FOR i IN 1 .. p_rows LOOP
12 PIPE ROW(t_tf_row(i, 'Description for ' || i));
13 END LOOP;
14 RETURN;
15END;
16-- Test it.
17SELECT * FROM TABLE(get_tab_ptf(10)) ORDER BY id DESC;