【发布时间】:2013-01-09 11:35:29
【问题描述】:
我需要做一个接收列表作为参数的游标。我试过这个:
declare
type array_t is table of varchar(50); -- //also tried varray(10) instead of table
cursor c_cursor (p_list array_t) is
select
field_1
from
table_1
where
field_2 in p_list;
a_list array_t;
begin
a_list := array_t('aaa',
'bbb',
'cccc',
'ddd');
for v_cursor in c_cursor(a_list) loop
dbms_output.put_line(v_cursor.field_1);
end loop;
end;
我收到以下错误
ORA-06550: line 11, column 21:
PLS-00642: local collection types not allowed in SQL statements
我已经阅读了有关使用CREATE OR REPLACE 方法的信息,但在这种情况下我不能使用CREATE OR REPLACE(实际上数据库是只读的)。
有什么可能的解决办法吗?
【问题讨论】:
-
请添加查询的预期输出。