Tuesday, June 23, 2015

ORA-12838

If you do an INSERT /* APPEND */, you cannot query the table afterwards until you have done a COMMIT. If you try to do so, Oracle gives you an ORA-12838. You can see what I mean in the example below, which I tested on Oracle 11.2:

SQL> create table tab1
  2  as select * from dba_tables
  3  where 1 = 2
  4  /
 
Table created.
 
SQL> insert /*+ append */ into tab1
  2  select * from dba_tables
  3  /
 
3166 rows created.
 
SQL> select count(*) from tab1
  2  /
select count(*) from tab1
                     *
ERROR at line 1:
ORA-12838: cannot read/modify an object after
modifying it in parallel
 
SQL> commit
  2  /
 
Commit complete.
 
SQL> select count(*) from tab1
  2  /
 
  COUNT(*)
----------
      3166
 
SQL>

No comments:

Post a Comment