Insert as select, capture errors
I have a bunch of tables to migrate to a new schema. Can someone get me started with a pl/sql script to capture errors and write thes to a log, etc. Here is the simple insert as select:
The problem is that if 1 row has a bad value or a duplicate key in the new schema, nothing is moved over. I want to move over everything possible, and write a log file of the errors and rows that could not move over.
INSERT INTO TEST.GEORGE_AT_TYPE(
Any suggestions are appreciated.
I WilliamR's suggestion is to use PL/SQL and loop through a cursor catching any errors that occur inside the loop.
for r1 in (SELECT DISTINCT
insert into ....
-- log error or something
You don't mention what version you are on, but if you are on 10gR2, you may want to consider the following:
The error_logging_clause lets you capture DML errors and the log column values of the affected rows and save them in an error logging table.
Yes that was exactly what I was suggesting. I would try to avoid loops if possible.
Click Here to Expand Forum to Full Width