Oracle PL/SQL如何选择表类型的局部变量

Oracle PL/SQL如何选择表类型的局部变量,oracle,select,plsql,Oracle,Select,Plsql,InListNumber是Oracle的数字表 如何准备预先计算好的客户列表并将其存储在l_customers中,这样我就不需要在其他update/select语句中使用长select语句了 PROCEDURE "ARCHIVE_CASE_LIST" ( a_case_id_list IN INLISTNUMBERS ) IS l_customers INLISTNUMBERS; 插入到表中(l_客户)使用SELECT语句和批量收集: insert into table(l_c

InListNumber是Oracle的数字表

如何准备预先计算好的客户列表并将其存储在l_customers中,这样我就不需要在其他update/select语句中使用长select语句了

PROCEDURE "ARCHIVE_CASE_LIST"
(
    a_case_id_list IN INLISTNUMBERS
)
IS
  l_customers INLISTNUMBERS;
插入到表中(l_客户)使用SELECT语句和批量收集:

  insert into table(l_customers) <-- fail
    select distinct case1.customer_id into l_customers from case case1
      where case1.case_id in (select column_value from table(a_case_id_list)) and
        not exists (select 0 from case case2 where case2.customer_id = case1.customer_id and
          case2.lifecycle_code not in (code_id('LIFECYCLE','A'), code_id('LIFECYCLE','D')));

  update customer set customer.lifecycle_code = code_id('LIFECYCLE','A')
    where customer.customer_id in (select column_value from table(l_customers));

  open l_persons for 
    select person_id from person where person.customer_id in
      (select column_value from table(l_customers));
select distinct case1.customer_id bulk collect into l_customers
from case case1
  where case1.case_id in (select column_value from table(a_case_id_list)) and
    not exists (select 0 from case case2 where case2.customer_id = case1.customer_id and
      case2.lifecycle_code not in (code_id('LIFECYCLE','A'), code_id('LIFECYCLE','D')));