日期:2014-05-16  浏览次数:20491 次

oracle方法多个返回值
create table tb1(k number, v varchar2(10));

insert into tb1(k, v) values(100,'aaa');
insert into tb1(k, v) values(200,'bbb');
insert into tb1(k, v) values(200,'ccc');

select * from tb1;

create type row_type1 as object(k number, v varchar2(10));

create type table_type1 as table of row_type1;

create or replace function fun1 return table_type1 pipelined as
v row_type1;
begin
     for myrow in (select k, v from tb1) loop
       v := row_type1(myrow.k, myrow.v);
       pipe row (v);
     end loop;
     return;
end;

select * from table(fun1);