【发布时间】:2020-03-07 11:13:28
【问题描述】:
我有一个过程,我试图在 where 语句中使用一个集合。
procedure purge_table is
type t_ids is table of number;
arr_ids t_ids ;
begin
select distinct (s.id) bulk collect
into arr_ids
from students s;
select count(*)
into v_deleted_row_count
from students s
where s.id in (select * from table(arr_ids));
end;
对于包含 where 语句的行,我收到“本地集合类型不允许 i SQL 语句”。 据我所知,我搜索了错误,但我的语法是正确的,但我不明白是什么 “假设你的集合是在 SQL 中定义的,而不仅仅是在 PL/SQL 中,你可以使用 TABLE 运算符” 在此处接受的答案中提到:Array in IN() clause oracle PLSQL。
这里也是公认的答案
建议和我做的一样。
我猜它必须与在 SQL 中定义一个集合有关。你能帮我解决这个问题吗?
【问题讨论】:
标签: oracle stored-procedures plsql plsqldeveloper