首页  »   数据库

oracle步骤多个返回值

网友分享于:2013-08-23  浏览:27次
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);

相关解决方案

最新解决方案