定义对象类型:
create or replace type type_row as object
(
id int,
name varchar2(50)
)
修改表对象类型的定义语句如下:
create or replace type type_table is table of type_row;
1)、管道化表函数方式:
create or replace function f_pipe(s number)
return type_table pipelined
as
v_type_row type_row;
begin
for i in 1..s loop
v_type_row := type_row(i,to_char(i*i));
pipe row(v_type_row);
end loop;
return;
end f_pipe;
测试:select * from table(f_pipe(5));
2)、 普通的方式:
create or replace function f_normal(s number)
return type_table
as
rs type_table:= type_table();
begin
for i in 1..s loop
rs.extend;
rs(rs.count) := type_row(rs.count,’name’||to_char(rs.count));
–Result(Result.count) :=