oracle - 在包中定义集合类型
问题描述
在模式级别创建集合类型时,此测试包编译良好:
create type table_of_ids as table of number;
create or replace package test_package as
procedure test_p(my_input table_of_ids);
end;
create or replace
package body test_package as
procedure test_p(my_input table_of_ids) as
res_tab table_of_ids;
begin
select res_id bulk collect
into res_tab
from test_table
where id in (select column_value from table (my_input));
null;
end test_p;
end test_package;
但是当我尝试在包中定义集合类型时,它失败了:
create or replace package test_package as
type my_table is table of number;
procedure test_p(my_input my_table);
end;
create or replace
package body test_package as
procedure test_p(my_input my_table) as
res_tab my_table;
begin
select res_id bulk collect
into res_tab
from test_table
where id in (select column_value from table (my_input));
null;
end test_p;
end test_package;
我收到的消息是:
Error(8,5): PL/SQL: SQL Statement ignored
Error(8,107): PL/SQL: ORA-22905: cannot access rows from a non-nested table item
Error(8,113): PLS-00642: local collection types not allowed in SQL statement
那么,这是否意味着我不能只在包中定义这种类型?或者我错过了什么?
解决方案
推荐阅读
- r - 同时使用ggplot进行分组和着色
- java - 当我们在 linux 中为 selenium 执行“mvn test”时,不会创建日志文件夹
- arrays - 在 mongodb 的嵌套数组中的过滤器后包含数组索引
- html - 为什么悬停后看不到特定部分?
- sql-server - 如何在 SQL Server 2008 中获取一行中的计数
- dax - PowerPivot DAX 日期查找
- python - 在文本文件中搜索并保存在 Excel 中
- css - 用另一种字体设计数字
- regex - 正则表达式在第一次出现字符之前获取所有内容
- python - 如何使用 Python 在 Outlook 中提取电子邮件正文的一小部分?