1CREATE TYPE object_row_type as OBJECT (
2 object_type VARCHAR(18),
3 object_name VARCHAR(30)
4);
5
6CREATE TYPE object_table_type as TABLE OF object_row_type;
7
8CREATE OR REPLACE FUNCTION get_all_objects
9 RETURN object_table_type PIPELINED AS
10BEGIN
11 FOR cur IN (SELECT * FROM all_objects)
12 LOOP
13 PIPE ROW(object_row_type(cur.object_type, cur.object_name));
14 END LOOP;
15 RETURN;
16END;
17
18SELECT * FROM TABLE(get_all_objects);
1create or replace function return_table return t_table as
2 v_ret t_table;
3begin
4
5 --
6 -- Call constructor to create the returned
7 -- variable:
8 --
9 v_ret := t_table();
10
11 --
12 -- Add one record after another to the returned table.
13 -- Note: the »table« must be extended before adding
14 -- another record:
15 --
16 v_ret.extend; v_ret(v_ret.count) := t_record(1, 'one' );
17 v_ret.extend; v_ret(v_ret.count) := t_record(2, 'two' );
18 v_ret.extend; v_ret(v_ret.count) := t_record(3, 'three');
19
20 --
21 -- Return the record:
22 --
23 return v_ret;
24
25end return_table;
26/
27