PL/SQL Append_Values Hint gives error message PL/SQL Append_Values Hint gives error message oracle oracle

PL/SQL Append_Values Hint gives error message


You get this error because every your INSERT executes as a separate DML statement. Oracle prevents read/write on the table where data were added using direct path insert until commit.Technically you can use PL/SQL collections and FORALL instead:

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  /

But the question Justin asked is in action - where are your data coming from and why can't you use usual INSERT /*+ append */ INTO ... SELECT FROM approach ?


Hi Request you to use commit after insert as below:

BEGINFOR iter in 1..100 LOOPINSERT /*+ APPEND_VALUES*/ INTO test_append_value_hint values (iter);COMMIT;END LOOP;END;


We cannot execute 2 DML transactions in a table without committing the first transaction. And hence this error will be thrown.

SO, commit your previous transaction in that table and continue the second transaction.