关于procedure or function 返回的记录集不能select的问题!!!

fi9 fi9 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
现在有这么一个问题:
统计一批记录,然后再返回统计的记录集回来;现在的是问题是怎么通过select之类的语句来出其结果?!或者有什么更加好的方法!?
附我现在写的一段:
create or replace package myp is
type r_my_record is record (a1 ....);
type t_my_table is table of r_my_record ...;
....

create or replace package body myp is
function myf(param char(2)) return t_my_table is
i integer := 0;
a integer;
b integer;
...
mytable t_my_table;
cursor c_my is select aa from bb;
begin
open cursor;
loop
fetch cursor into a;
select sum(*) into b from bb where no=a;
....
mytable(i).a := a;
....
i := i + 1;
end loop;
return mytable;
end;
end;

当我created后,我用select myp.myf('0') from dual;来执行说无效的类型!!?!(主要是返回来的mytable select不能识别!)

不知道哪位高人知道!?或者有什么更妙的方法!?请多指点!谢谢!!!
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
fi9
Oracle 17,133 成员 55,258 内容