Skip to content
June 3, 2011 / doganay

LOG EXCEPTIONS ON INSERT, ERRORING ON PK VIOLATION

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

 

Hi,

 

You can log rows that you could not insert to a table because of pk , etc.

 
EXECUTE DBMS_ERRLOG.CREATE_ERROR_LOG('mytable', 'myerrtable');

INSERT INTO mytable
...
LOG ERRORS INTO myerrtable ('my_bad')
REJECT LIMIT 100000;
--Note: set reject limit to count of your original table(mytable) to guarantee
--that you log every row that can not be inserted..

 

try and pray 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: