【发布时间】:2021-04-19 14:48:02
【问题描述】:
尝试使用 for 循环将数据插入表中,对于表客户,我将数据放入 3 个分区。
这里是代码
begin
FOR var_1 in 1 .. 3
LOOP
INSERT into tmp_table
(
SELECT cust_no FROM customer PARTITION (customer_PR$var_1)
WHERE city='ba' AND first_name='john'
AND salary=1000);
commit;
END LOOP;
END;
/
我得到结果
Error report -
ORA-02149: Specified partition does not exist
ORA-06512: at line 4
02149. 00000 - "Specified partition does not exist"
*Cause: Partition not found for the object.
*Action: Retry with correct partition name.
但是当我正常运行时(对于分区1),
SELECT cust_no FROM customer PARTITION (customer_PR1);
我得到了预期的输出。
【问题讨论】:
-
$ 不是在 PL/SQL 中引用变量的方式
-
@CyrilleMODIANO 那么应该使用什么?管道?