oracle – PL / SQL Append_Values提醒提供错误动静
发布时间:2021-03-22 22:53:37 所属栏目:站长百科 来源:网络整理
导读:我无法行使PL / SQL在Oracle表中执行大量插入操纵.我的查询逐行举办,对付每一行,查询举办计较以确定必要插入另一个表的行数.传统的插入事变,但代码必要很长时刻才气运行大量的行.为了加速插入速率,我实行行使Append_Values提醒,如下例所示: BEGINFOR iter i
我无法行使PL / SQL在Oracle表中执行大量插入操纵.我的查询逐行举办,对付每一行,查询举办计较以确定必要插入另一个表的行数.传统的插入事变,但代码必要很长时刻才气运行大量的行.为了加速插入速率,我实行行使Append_Values提醒,如下例所示: BEGIN FOR iter in 1..100 LOOP INSERT /*+ APPEND_VALUES*/ INTO test_append_value_hint values (iter); END LOOP; END; 执行此操纵时,我收到以下错误动静: ORA-12838: cannot read/modify an object after modifying it in parallel ORA-06512: at line 3 12838. 00000 - "cannot read/modify an object after modifying it in parallel" *Cause: Within the same transaction,an attempt was made to add read or modification statements on a table after it had been modified in parallel or with direct load. This is not permitted. *Action: Rewrite the transaction,or break it up into two transactions one containing the initial modification and the second containing the parallel modification operation. 有没有人知道怎样使这个代码事变,或怎样快速插入大量的行到另一个表? 办理要领您收到此错误,由于您的每个INSERT都作为单独的DML语句执行. Oracle阻止对行使直接路径插入添加数据的表举办读/写,直到提交为止.从技能上讲,您可以行使PL / SQL荟萃和FORALL: SQL> declare 2 type array_t is table of number index by pls_integer; 3 a_t array_t; 4 begin 5 for i in 1..100 loop 6 a_t(i) := i; 7 end loop; 8 forall i in 1..100 9 insert /*+ append_values */ into t values (a_t(i)); 10 end; 11 / 但Justin问的题目是在动作 – 你的数据来自那边,为什么你不能行使凡是的INSERT / *追加* / INTO … SELECT FROM要领? (编辑:湖南网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |