- 论坛徽章:
- 0
|
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 package pkg_sx_agent as
--type row_type1 is record (k1 number, v varchar2(10));
--type table_type1 is table of row_type1;
function fun2 return table_type1 PIPELINED ;
end pkg_sx_agent;
create or replace package body pkg_sx_agent as
--type row_type1 is record (k1 number, v varchar2(10));
--type table_type1 is table of row_type1;
function fun2 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 fun2;
end pkg_sx_agent;
select * from table(pkg_sx_agent.fun2);
我现在想把这两句话放在包中定义
create type row_type1 as object(k number, v varchar2(10));
create type table_type1 as table of row_type1;
不知为什么老是报错,望各位帮帮忙,非常感谢。 |
|