在oracle 10gr2中,您可以使用insert命令的log
errors子句在单独的表中记录错误。这是一个例子:
SQL> create table test_table( 2 id number primary key, 3 col1 varchar2(7) 4 ) 5 ;Table created-- creates a table for logging errors (table name will be prefaced with err$_)SQL> begin dbms_errlog.create_error_log('TEST_TABLE'); end; 2 /PL/SQL procedure successfully completed-- violates primary key constraintSQL> insert into test_table(id, col1) 2 ( select 1, level 3 from dual 4 connect by level <= 3) 5 log errors reject limit unlimited;1 row insertedSQL> commit;SQL> select * from test_table; ID COL1---------- ------- 1 1SQL> select * from err$_test_table;ORA_ERR_NUMBER$ ORA_ERR_MESG$ ORA_ERR_ROWID$ ORA_ERR_OPTYP$ ORA_ERR_TAG$ ID COL1--------------- ------------------------------------------------------------------------------------------------------------ 1 ORA-00001: unique constraint (HR.SYS_C008315) violated I1 2 1 ORA-00001: unique constraint (HR.SYS_C008315) violated I1 3


