6

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.

このコードを機能させる方法、または多数の行を別のテーブルにすばやく挿入する方法について、誰かアイデアがありますか?

4

3 に答える 3