批量导入TXT文件
方法1.导文本文件到ORACLE
CREATE TABLE HKH_8月未拨打
(
PHONE_NUM VARCHAR2(11)
)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY TEMP
ACCESS PARAMETERS(RECORDS DELIMITED BY NEWLINE FIELDS TERMINATED BY ',')
LOCATION('HKH_181.TXT')
);
方法二 SQL LOADER 命令应用
1.创建表结构
CREATE TABLE HKH_LM
(
ACCT_MONTH VARCHAR2(8),
PHONE_NUM VARCHAR2(11),
PLAN_PRODUCT VARCHAR2(20)
)
2.编写控制文件
load data
infile 'D:\TEMP\联秘9.8号无效号码.CSV'
append into table hkh_lm
fields terminated by ","
(ACCT_MONTH,PHONE_NUM,PLAN_PRODUCT)
3.用SQLLDR命令导入
错误分析
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
解决办法:在你的库上建一个叫TEMP的DIRECTORY对象,然后赋给用户读写权限就可以了