table() function

-- create objects
create or replace type obj_type1 as object (
  c1 int,
  c2 int
);
/

create or replace type obj_tbl_type1 as table of obj_type1;
/

+++++++++++++++++++++++++++++++++++++++++

create or replace function func1
return obj_tbl_type1
pipelined
is
  v_obj obj_type1;
begin
  for idx in 1 .. 100 loop
    v_obj := obj_type1(idx, idx);
    pipe row(v_obj);
  end loop;
end;
/

++++++++++++++++++++++++++++++++++++++++++

select * from table(func1());

        C1         C2
---------- ----------
         1          1
         2          2
         3          3
         4          4
         5          5
...
        99         99
       100        100

原文地址:https://www.cnblogs.com/kevinkim/p/2363366.html