plsql function that return a table

Solutions on MaxInterview for plsql function that return a table by the best coders in the world

showing results for - "plsql function that return a table"
Euan
02 Nov 2018
1create or replace type t_record as object (
2  i number,
3  n varchar2(30)
4);
5/
6
Lilli
04 Mar 2016
1create or replace type t_table as table of t_record;
2/
3
Paolo
22 Aug 2018
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