Sunday, August 2, 2009

DML Error Log Feature

if you want to merge or insert too many rows , and want if the insertion or updating failed for some records a log error process to know wich the error in each row failed , so you should use the DML logging error feature of 10 release 2

-- first step is to make the database know which table you want to log by running the followin procedure

dbms.errorlog.create_error_log('your table name','error_log_yourtablename');

- a table will be created fo you with some built in columns and the coluns of your table

-- the second step is to add the procedure that run the error loggin process into your DML plsql code

-- LOG ERRORS INTO ERROR_LOG_TABLENAME REJECT LIMIT 1;

-- you can use this clause in the merge statement like this

merge into (table)
using (table,view)
on (condition)
when matched then
(update st)
when not matchec then ()
[log errors into .......... reject limit 1]

No comments: