xcor635
04-16-2006, 05:51 AM
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:
INSERT INTO TEST.GEORGE_AT_TYPE(
DISTRICT_NUMBER,
VALUE,
NAME,
DESCRIPTION,
STATE_CODE,
DWELLING_CATEGORY_CD,
IS_ACTIVE_IND,
UPDATE_TS,
UPDATED_BY,
ORDER_DEFAULT,
GENERATION)
SELECT DISTINCT
0098,
trim(PROD.LOADER_EV200.DWL_TY),
trim(PROD.LOADER_EV200.DWL_TY))),
trim(PROD.LOADER_EV200.DWL_DESCR),
trim(PROD.LOADER_EV200.DWL_ST_CD),
trim(PROD.LOADER_EV200.DWL_CAT),
1,
to_date(decode(trim(PROD.LOADER_EV200.MNT_DT),0,20060101), 'yyyymmdd'),
-1,
1,
1
FROM PROD.LOADER_EV200;
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.
Any suggestions are appreciated.
INSERT INTO TEST.GEORGE_AT_TYPE(
DISTRICT_NUMBER,
VALUE,
NAME,
DESCRIPTION,
STATE_CODE,
DWELLING_CATEGORY_CD,
IS_ACTIVE_IND,
UPDATE_TS,
UPDATED_BY,
ORDER_DEFAULT,
GENERATION)
SELECT DISTINCT
0098,
trim(PROD.LOADER_EV200.DWL_TY),
trim(PROD.LOADER_EV200.DWL_TY))),
trim(PROD.LOADER_EV200.DWL_DESCR),
trim(PROD.LOADER_EV200.DWL_ST_CD),
trim(PROD.LOADER_EV200.DWL_CAT),
1,
to_date(decode(trim(PROD.LOADER_EV200.MNT_DT),0,20060101), 'yyyymmdd'),
-1,
1,
1
FROM PROD.LOADER_EV200;
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.
Any suggestions are appreciated.