i want to develop a procedure for following scenario.
I have one source, one target and one error table. Target and Error tables have all fields that are present in source tables. But the data type of all fields for error table are varchar. Error table don't have integrity, foreign key and other constraints. Error table also have two more fields: Error no and error message.
Now when procedure is executed if there is error while inserting any record into target then that record shold be moved to error table. Also the data base error code and error message should be logged in the error tables fields as mentioned.
How can i devlop such a procedure?
Example of table schema:
source table
src(id number
,name varchar2(20)
, ... )
target table
tgt(id number
,name varchar2(20) not null
, ... )
error table
err (id varchar2(255)
,name varchar2(255)
, ...
, errno varchar2(255)
, errmsg varchar2(255))