前端之家收集整理的这篇文章主要介绍了
oracle函数返回table类型结果集,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
--创建自定义对象类型
CREATE OR REPLACE TYPE RetireOrderTemp AS OBJECT(A varchar2(200),B varchar2(200),C varchar2(200),D varchar2(200),E int,F int);
--创建自定义table表类型
CREATE OR REPLACE TYPE RetireOrderTempResult IS TABLE OF RetireOrderTemp;
/
create or replace function F_GD_XT_RETIRE_ORDER(sdate in varchar2,edate in varchar2) return RetireOrderTempResult
is
return_Result RetireOrderTempResult := RetireOrderTempResult();
begin
for order_info in (
select语句
) loop
return_Result.EXTEND;
return_Result(return_Result.COUNT) := RetireOrderTemp(A => order_info.a1,B=>order_info.a2,C=>order_info.a3,D => order_info.a4,E=>order_info.a5,F=>order_info.a6);
end loop;
return return_Result;
end;
/