1-- Build a pipelined table function.
2CREATE OR REPLACE FUNCTION get_tab_ptf (p_rows IN NUMBER) RETURN t_tf_tab PIPELINED AS
3BEGIN
4 FOR i IN 1 .. p_rows LOOP
5 PIPE ROW(t_tf_row(i, 'Description for ' || i));
6 END LOOP;
7
8 RETURN;
9END;
10/
11
12-- Test it.
13SELECT *
14FROM TABLE(get_tab_ptf(10))
15ORDER BY id DESC;
16
17 ID DESCRIPTION
18---------- --------------------------------------------------
19 10 Description for 10
20 9 Description for 9
21 8 Description for 8
22
23