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

posted on 2012-02-22 16:33  Kevin Kim  阅读(198)  评论(0)    收藏  举报

导航