【发布时间】:2017-12-06 08:42:10
【问题描述】:
我有一个具有 OUT sys_refcursor 的过程:
CREATE OR REPLACE PROCEDURE get_detail_data(RC1 IN OUT sys_REFCURSOR)
IS ...
现在在另一个过程中,我正在尝试针对该过程的输出计算一些统计数据,以便将它们插入到表中:
CREATE OR REPLACE PROCEDURE load_stats
AS
cur_detail SYS_REFcursor;
BEGIN
-- Load the data from the "get_detail_data" procedure
get_detail_data(cur_detail);
-- Now lets calculate some stats against that detail data and insert
insert into stats_table (
select
id_number, sum(amount)
from table(cur_detail) -- obviously this is not valid
)
END;
如何对 sys_refcursor 数据集运行查询并将这些结果插入到另一个表中?
【问题讨论】:
标签: oracle stored-procedures plsql