将csv文件加载到多个Oracle表中

时间:2013-01-30 15:36:17

标签: oracle11g sql-loader controlfile

我使用TOADs SQL* Loader Wizard创建了一个控制文件。我已经使用指定的以下两个表来加载数据,但是运行数据之后只加载到一个表中并生成了一个dsc文件。下面是我正在使用的控制文件:

LOAD DATA
INFILE '\\ANKH\Logs\production export 2012-12-06\BS7666CSV_001.csv' 
BADFILE '\\ANKH\Logs\production export 2012-12-06\BS7666CSV_001.bad'
DISCARDFILE '\\ANKH\Logs\production export 2012-12-06\BS7666CSV_001.dsc'

INTO TABLE "STREET"
TRUNCATE
WHEN (record_id = '11')
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' AND '"'
(RECORD_ID,
CHANGE_TYPE,
PRO_ORDER,
USRN,
TYPE,
AUTH_CODE,
STATE,
STATE_DATE,
SURFACE,
CLASS,
VERSION,
START_DATE,
END_DATE,
LAST_UPDATE_DATE,
ENTRY_DATE,
START_X_COORD,
START_Y_COORD,
END_X_COORD,
END_Y_COORD,
TOLERANCE)

INTO TABLE "STREET_DESCRIPTOR"
TRUNCATE
WHEN (record_id = '15')
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"' AND '"'
(RECORD_ID,
CHANGE_TYPE,
PRO_ORDER,
USRN,
DESCRIPTOR,
LOCALITY,
TOWN,
ADMIN_AREA,
LANGUAGE)

1 个答案:

答案 0 :(得分:0)

我发现我在第二个POSITION(1)语句中缺少关键字INTO TABLE以重置指向记录开头的指针。