使用外部表加载平面文件。由于列中的多行值,一些字段被遗漏 我们如何加载所有记录,包括多行列?
数据样本:
--first line
56585,0,4032,,1,790035190,,2,2,,1,1,1,06-SEP-07,,,,,0,EUR ,0,06-SEP-07,1,790035190,2,,0,,,,,,,,,,,,2,2,2,,,,,,,,06-SEP-07,,,,,,,,,1,,,,,,,,,,,
--second line
24188,31,4032,This is the Title,1,790035190,,2,2,,1,1,1,06-SEP-07,,,,,0,EUR ,0,06-SEP-07,1,790035190,2,,0,,Value 1
Value 2
Value 3
Value 4,,,,,,,,,,2,2,2,,,,,,,,06-SEP-07,,,,,,,,,1,,,,,,,,,,,1
外部表架构:
CREATE TABLE OFFERS_EXT
(
OFFER_ID NUMBER(10) ,
AMENDMENT_ID NUMBER(10) ,
CLIENT_ID NUMBER(10) ,
BUSINESS_UNIT_NAME VARCHAR2(120 BYTE),
RED_FLAG_STATUS NUMBER(10) ,
CREATED_BY VARCHAR2(30 BYTE) ,
RED_FLAG_COMMENTS VARCHAR2(765 BYTE),
OFFER_CATEGORY_ID NUMBER(10) ,
OFFER_PRIORITY_ID NUMBER(10) ,
OFFER_PRIORITY_COMMENTS VARCHAR2(765 BYTE),
OFFER_STATUS_ID NUMBER(10) ,
SOLD_IN NUMBER(10),
END_TYPE_ID NUMBER(10) ,
OFFER_START_DATE DATE,
OFFER_DUE_SUBMITTED_DATE DATE,
VALIDITY_DATE DATE,
CONTRACT_SIGNED_DATE DATE,
CONTRACT_START_DATE DATE,
CONTRACT_DURATION NUMBER(5),
TOTAL_OFFER_VALUE VARCHAR2(57 BYTE),
NUMBER_OF_OFFER_SITES NUMBER(10),
CREATED_TIMESTAMP DATE ,
LANGUAGE_ID NUMBER(10) ,
LAST_UPDATED_BY VARCHAR2(30 BYTE) ,
TIME_RISK_ID NUMBER(10) ,
RISK_COMMENTS VARCHAR2(765 BYTE),
PROBABILITY_OF_WIN NUMBER(5),
PROBABILITY_OF_WIN_DATE DATE,
COMMENTS VARCHAR2(765 BYTE),
ADDRESS_ID NUMBER(10),
WIN_LOSS_PRICE VARCHAR2(3 BYTE),
WIN_LOSS_DESCRIPTION VARCHAR2(3 BYTE),
WIN_LOSS_QUALITY_SERVICE VARCHAR2(3 BYTE),
WIN_LOSS_AVAILABILITY VARCHAR2(3 BYTE),
WIN_LOSS_INCOMPLETE_PORTFOL VARCHAR2(3 BYTE),
WIN_LOSS_REASONS_TEXT VARCHAR2(765 BYTE),
WIN_LOSS_COMMENTS VARCHAR2(765 BYTE),
WIN_LOSS_CONCLUSIONS VARCHAR2(765 BYTE),
SERVICE_RISK_ID NUMBER(10) ,
TECHNICAL_RISK_ID NUMBER(10) ,
FINANCIAL_RISK_ID NUMBER(10) ,
SPECIAL_DISCOUNT NUMBER(5),
SPECIAL_DISCOUNT_INSTALLATIO NUMBER(5),
DISCOUNT_REASONS VARCHAR2(765 BYTE),
DISCOUNT_REPLY VARCHAR2(765 BYTE),
WIN_LOSS_DISCOUNT VARCHAR2(3 BYTE),
WIN_LOSS_OTHER VARCHAR2(3 BYTE),
WIN_LOSS_POLITICAL VARCHAR2(3 BYTE),
LAST_UPDATED_TIMESTAMP DATE ,
ORDER_INST_COUNTRY_ID NUMBER(10),
FM_ORDER_NR VARCHAR2(60 BYTE),
CONTRACT_END_DATE DATE,
BANK_ID NUMBER(10),
BID_TOOL_ID NUMBER(10),
FINANCIAL_RISK_COMMENT VARCHAR2(765 BYTE),
SERVICE_RISK_COMMENT VARCHAR2(765 BYTE),
TECHNICAL_RISK_COMMENT VARCHAR2(765 BYTE),
CONTRACT_CHECK_ID NUMBER(10),
CONTRACT_CHECK_DATE DATE,
CONTRACT_CHECK_BY VARCHAR2(30 BYTE),
CONTRACT_CHECK_COMMENTS VARCHAR2(1536 BYTE),
CONTRACT_CHECK_REPLY VARCHAR2(1536 BYTE),
CONTRACT_PARALLEL_FLAG NUMBER(1),
FRC_FLAG VARCHAR2(3 BYTE),
FRC_OFFER_ID NUMBER(10),
FRC_AMENDMENT_ID NUMBER(10),
FRC_COPYDATAFLAG VARCHAR2(3 BYTE),
CONTRACT_CANCEL_DATE DATE,
REFERS_TO_AMENDMENT NUMBER(10)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY EXTERNAL_DIR_RE
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE CHARACTERSET WE8ISO8859P1
BADFILE REJECT_DIR_RE:'OFFERS_EXT.bad'
LOGFILE REJECT_DIR_RE:'OFFERS_EXT.log'
LOAD WHEN (OFFER_ID != 'FILETRAILER')
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
(
OFFER_ID ,
AMENDMENT_ID ,
CLIENT_ID ,
BUSINESS_UNIT_NAME ,
RED_FLAG_STATUS ,
CREATED_BY ,
RED_FLAG_COMMENTS ,
OFFER_CATEGORY_ID ,
OFFER_PRIORITY_ID ,
OFFER_PRIORITY_COMMENTS ,
OFFER_STATUS_ID ,
SOLD_IN ,
END_TYPE_ID ,
OFFER_START_DATE date "DD-MON-YYYY HH24:MI:SS" ,
OFFER_DUE_SUBMITTED_DATE date "DD-MON-YYYY HH24:MI:SS" ,
VALIDITY_DATE date "DD-MON-YYYY HH24:MI:SS" ,
CONTRACT_SIGNED_DATE date "DD-MON-YYYY HH24:MI:SS" ,
CONTRACT_START_DATE date "DD-MON-YYYY HH24:MI:SS" ,
CONTRACT_DURATION ,
TOTAL_OFFER_VALUE ,
NUMBER_OF_OFFER_SITES ,
CREATED_TIMESTAMP date "DD-MON-YYYY HH24:MI:SS" ,
LANGUAGE_ID ,
LAST_UPDATED_BY ,
TIME_RISK_ID ,
RISK_COMMENTS ,
PROBABILITY_OF_WIN ,
PROBABILITY_OF_WIN_DATE date "DD-MON-YYYY HH24:MI:SS" ,
COMMENTS ,
ADDRESS_ID ,
WIN_LOSS_PRICE ,
WIN_LOSS_DESCRIPTION ,
WIN_LOSS_QUALITY_SERVICE ,
WIN_LOSS_AVAILABILITY ,
WIN_LOSS_INCOMPLETE_PORTFOL ,
WIN_LOSS_REASONS_TEXT ,
WIN_LOSS_COMMENTS ,
WIN_LOSS_CONCLUSIONS ,
SERVICE_RISK_ID ,
TECHNICAL_RISK_ID ,
FINANCIAL_RISK_ID ,
SPECIAL_DISCOUNT ,
SPECIAL_DISCOUNT_INSTALLATIO ,
DISCOUNT_REASONS ,
DISCOUNT_REPLY ,
WIN_LOSS_DISCOUNT ,
WIN_LOSS_OTHER ,
WIN_LOSS_POLITICAL ,
LAST_UPDATED_TIMESTAMP date "DD-MON-YYYY HH24:MI:SS" ,
ORDER_INST_COUNTRY_ID ,
FM_ORDER_NR ,
CONTRACT_END_DATE date "DD-MON-YYYY HH24:MI:SS" ,
BANK_ID ,
BID_TOOL_ID ,
FINANCIAL_RISK_COMMENT ,
SERVICE_RISK_COMMENT ,
TECHNICAL_RISK_COMMENT ,
CONTRACT_CHECK_ID ,
CONTRACT_CHECK_DATE date "DD-MON-YYYY HH24:MI:SS" ,
CONTRACT_CHECK_BY ,
CONTRACT_CHECK_COMMENTS ,
CONTRACT_CHECK_REPLY ,
CONTRACT_PARALLEL_FLAG ,
FRC_FLAG ,
FRC_OFFER_ID ,
FRC_AMENDMENT_ID ,
FRC_COPYDATAFLAG ,
CONTRACT_CANCEL_DATE date "DD-MON-YYYY HH24:MI:SS" ,
REFERS_TO_AMENDMENT
)
)
LOCATION (EXTERNAL_DIR_RE:'OFFERS_EXT.dat')
)
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;
答案 0 :(得分:0)
您指定"记录由NEWLINE"删除,即任何新行都将被视为新行。如果源文件中有多行值,则需要使用1)新行的另一个分隔符或2)在使用批处理脚本加载之前将多行值合并为单行。您的多行值未包含在双引号中是否正确?