我正在开发一个将返回两个游标的包。一个光标是带有数字主键的项目列表。另一个光标是与项目关联的文件列表
到目前为止的代码:
procedure get_items_with_files(
o_results out sys_refcursor,
o_files out sys_refcursor
) is
begin
begin
open o_results for
select item_id,
item_name
from items;
end;
begin
open o_files for
select item_id
item_file_name
from item_files if
where if.item_id in (select item_id from TABLE(CAST(o_results)));
end;
end get_items_with_files;
我遇到问题的领域:
- 在 table(cast(cursor)) 部分获取缺少关键字错误
- 我可以按原样访问代码中的光标还是需要将其复制到内部变量中?我试图创建一个 sys_refcursor 类型的变量和一个“set v_cursor := o_results”,但得到一个缺失或无效的选项错误。