返回类型是表类型的函数怎样调用

gahade gahade 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
create or replace type obj_table as object (id number,col varchar2(100));

type table_type is table of obj_table;

function f_returntable(str in out varchar2) return table_type
as
t_1 table_type;

begin
if str is null then
return t_1;
end if;
while instr(str,',')>0 loop
t_1.extend;
t_1(t_1.count).id:=t_1.count;
t_1(t_1.count).col:=substr(str,1,instr(str,',')-1);
str:=substr(str,instr(str,','),length(str));
end loop;
t_1(t_1.count).id:=t_1.count;
t_1(t_1.count).col:=str;
return t_1;
end f_returntable;

这样调用时出错,
select * from table(mypkg.f_returntable('a,b,cc'))
ORA-00902: 无效数据类型

请问应该怎样调用返回是表类型的函数啊?
...全文
评论 6
收藏 已收藏
分享
返回顶部
gahade
基础和管理 17,380 成员 95,111 内容