Tip ; DML error capture

August 24th, 2010 | Posted in Blog, oracle error ora | 2 Comments



Test applied on:

Oracle Server – Enterprise Edition – Version: 10.2.0.1.0 – 64 bit.

Goal:

This document gives a tip of how to get a log of the errors captured after executing a DML.

The tip:

CREATE TABLE t1 (col1 NUMBER PRIMARY KEY);
CREATE TABLE t2 (col1 NUMBER PRIMARY KEY);

INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
INSERT INTO t1 VALUES(4);
INSERT INTO t2 VALUES(1);
INSERT INTO t2 VALUES(2);
INSERT INTO t2 VALUES(3);
INSERT INTO t2 VALUES(8);
INSERT INTO t2 VALUES(9);
COMMIT;

Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as wissem

SQL> EXECUTE DBMS_ERRLOG.CREATE_ERROR_LOG(‘t1′);

PL/SQL procedure successfully completed

SQL> insert into t1 select * from t2 log errors reject limit unlimited;

2 rows inserted

SQL> desc err$_t1;
Name Type
————— ————–
ORA_ERR_NUMBER$ NUMBER
ORA_ERR_MESG$ VARCHAR2(2000)
ORA_ERR_ROWID$ UROWID(4000)
ORA_ERR_OPTYP$ VARCHAR2(2)
ORA_ERR_TAG$ VARCHAR2(2000)
COL1 VARCHAR2(4000)

SQL> select ORA_ERR_NUMBER$,ORA_ERR_MESG$,COL1 from err$_t1;

ORA_ERR_NUMBER$ ORA_ERR_MESG$ COL1
————— ——————————————————————————– ——————————————————————————–
1 ORA-00001: unique constraint (WISSEM.SYS_C0076732) violated 1
1 ORA-00001: unique constraint (WISSEM.SYS_C0076732) violated 2
1 ORA-00001: unique constraint (WISSEM.SYS_C0076732) violated 3

SQL>
You can easily note that 1, 2 and 3 are the values rejected because of the unique constraint.

Scridb filter


2 Comments to “Tip ; DML error capture”

  1. Padmanabh Deshpande says:

    Hi Wissem,

    This is really very good blog.
    Please keep writing.
    Thanks


Leave a Comment





Subscribe


Polls

which oracle topic interests you most?

View Results

Loading ... Loading ...


Oracle Class Tweets


Recent Posts


Recent Comments

  • Jaspreet: Brilliant explanation.
  • Yousuf: Very Nice… Just wanted to check you have done all patching at Node 1 only.. is there any thing need to...
  • Yousuf: Very Nice.. Thanks for sharing.. Once question.. You have executed all commands on Node 1 only.. Is there any...
  • Emir: Thanks… Great article
  • borse firmate: Thank you for another informative blog. The place else may just I am getting that kind of information...
  • leandro: why this parameter is systemwide? could you read from a asm instance from one failure group and from the...
  • Mohammad: paul, we create pfile from target database to source database and later we change database name, and...
  • Muhammad Ikram: Thanks Brother for sharing pearls of knowledge. May ALLAH reward you for this both here and...
  • rgrover: Thanks for the POST. I recently encounter similar issue. Your POST helped.
  • gopalredy: really its very use full to dbas
  • Vivian: This is awesome! Thank you so much!
  • henry zhong: CDB=DB, and PDB=SCHEMA but in a sub dictionary?
  • Dehbashee: Salam Brother, Thanx for sharing, however, i would be interested in chaging the password for the grid user...
  • wissem: No we don’t need that :) Just the scripts I posted above
  • Md. Tanweer: Thanks for posting the material. I really appreciate if you can send me, if you have tutorial for 11g...
  • christiaan: Thanks!! This has been bugging the hell out of me for so long.
  • Rajasekhar: Thank you
  • Samarjit Panigrahy: Very Nice and Simple Demo… Cool :)
  • cq: Any reason not to use auto patch for both CRS and RAC homes with one command? Or use opatch auto for RAC home as...
  • Hitesh: Hi, Can we use this RACcheck tool on oracle SE version ? Thanks