- 最后登录
- 2015-3-26
- 在线时间
- 148 小时
- 威望
- 84
- 金钱
- 1061
- 注册时间
- 2011-11-26
- 阅读权限
- 50
- 帖子
- 128
- 精华
- 0
- 积分
- 84
- UID
- 96
|
1#
发表于 2013-2-26 16:21:22
|
查看: 4318 |
回复: 3
数据库版本:11.2.0.3 数据库字符集:AMERICAN_AMERICA.ZHS16GBK
纠结的问题:使用sqlldr 命令向数据库表中加载数据时发现txt文件中的分割符'§'不识别,把它替换成其它字符就可以。
补充:无论是数据库字符集为AMERICAN_AMERICA.ZHS16GBK 还是AMERICAN_AMERICA.AL32UTF8创建一个表,插入字符'§' 查询结果均为??。不知道什么样的字符集中包含这样的字符?linux系统的字符集UTF8是可以识别的,oracle中呢?另外:这个变态的字符是阿三给我们项目组提供的,难道他是要挑战国人的技术吗?
资料:
1、需要加载数据的表
-- Create table
create table DF_XREF
(
LE_ID VARCHAR2(300),
SUB_PROFILE_ID VARCHAR2(3),
EXTERNAL_SYSTEM_XREF_ID VARCHAR2(20),
EXTERNAL_SYSTEM VARCHAR2(20),
EXTERNAL_SYSTEM_LOCATION VARCHAR2(20),
EXTERNAL_SYSTEM_CUSTOMER_ID VARCHAR2(21),
EXTERNAL_SYSTEM_CUSTOMER_NAME VARCHAR2(100),
ACCOUNT_NO VARCHAR2(10),
ACCOUNT_STATUS VARCHAR2(10),
DATA_DATE VARCHAR2(10)
)
2、控制文件
OPTIONS(DIRECT=TRUE,SKIP=1,ROWS=10000)
LOAD DATA
INFILE 'c:\xref_report_active.txt'
truncate INTO TABLE df_xref
FIELDS TERMINATED BY "§" optionally enclosed by '"'
trailing nullcols
( LE_ID ,
SUB_PROFILE_ID ,
EXTERNAL_SYSTEM_XREF_ID ,
EXTERNAL_SYSTEM ,
EXTERNAL_SYSTEM_LOCATION ,
EXTERNAL_SYSTEM_CUSTOMER_ID ,
EXTERNAL_SYSTEM_CUSTOMER_NAME ,
ACCOUNT_NO ,
ACCOUNT_STATUS
)
3、sqlldr命令 在linux下运行更方便
@echo off
echo -------------------------
echo ---装载数据
echo -------------------------
sqlldr datacore/SAFE123@UPRR_CFA control=c:\XREF.ctl errors=1000 rows=1000
file=c:\xref_report_active.txt
log=c:\XREF_log.txt
bad=c:\XREF_bad.txt;
echo ------------------------
echo ---数据装载成功
echo ------------------------
4、文本文件样例
1259676@§1§3@659703§OAF§SCCNCN§0§JIANGSU HENGTAI DIANLI WUZI CO.,LTD§§
1259676@§1§3@659701§EBBS§SCCNCN§8939918§JIANGSU HENGTAI DIANLI WUZI CO.,LTD§§
1259686@§1§3@660691§OAF§SCCNCN§0§BEIJING RUIZHIYUAN TRADE CO., LTD§§
1259686@§1§3@660693§IMEX§SCCNCN§12596860-Y2BCRTD§BEIJING RUIZHIYUAN TRADE CO., LTD§§
1259686@§1§3@659745§EBBS§SCCNCN§12596860-Y2BCRTD§BEIJING RUIZHIYUAN TRADE CO., LTD§§
1259686@§1§3@659744§CRM§SCCNCN§LI97 T476§BEIJING RUIZHIYUAN TRADE CO., LTD§§
12595@@0§1§30660831§OAF§SCCNCN§0§CHAOYANG HONGKONG AND CHINA GAS COMPANY LIMITED§§
12595@@0§1§30657850§EBBS§SCCNCN§8976430§CHAOYANG HONGKONG AND CHINA GAS COMPANY LIMITED§§
12595@@0§1§30657849§CRM§SCCNCN§0000281579§Chaoyang HongKong and China Gas Company Limited§§
12595@@0§1§30681129§eCDD§SCCNCN§CDD00003070§Chaoyang HongKong and China Gas Company Limited§§
1258782@§1§3@646670§TCIMEX§SCCNCN§12587820-Y2BCRTD§TIANJIN RONG XING WINE CO., LTD§§
1258782@§1§3@646669§OAF§SCCNCN§0§TIANJIN RONG XING WINE CO., LTD§§
1258782@§1§3@646271§EBBS§SCCNCN§0§Tianjin Rong Xing Wine Co., LTD§§
1258782@§1§3@646270§CRM§SCCNCN§LI484 P18§Tianjin Rong Xing Wine Co., LTD§§
1258788@§1§3@646303§OAF§SCCNCN§0§LANGFANG WANGYING ELECTRONIC TECHNOLOGY CO.,LTD CHONGQI§§
1258788@§1§3@646301§EBBS§SCCNCN§8914427§LANGFANG WANGYING ELECTRONIC TECHNOLOGY CO.,LTD CHONGQI§§
126@928@§1§30683752§EBBS§SCCNCN§8241562§DONG GUAN SHI TANG XIA DE SHENG JI XIE CHANG§§
126@9281§1§3@683753§EBBS§SCCNCN§7724845§HANG ZHOU LIAN KUN MAO YI YOU XIAN GONG SI§§
126@9282§1§3@683754§EBBS§SCCNCN§7465858§HANG ZHOU YAO WEI KE JI CO LTD§§
126@9283§1§3@683755§EBBS§SCCNCN§4090926§HANGZHOU BAOLAI NETWORK EQUIPMENT CO LTD§§
126@9283§1§3@692876§RLS§SCCNCN§00687758§*HANGZHOU BAOLAI NETWORK EQUIPMENT CO LTD§§
126@9284§1§3@683756§EBBS§SCCNCN§4080939§HANGZHOU DINGZUN SCIENCE AND TECHNOLOGY CO LTD§§
126@9284§1§3@689489§RLS§SCCNCN§01085514§*HANGZHOU DINGZUN SCIENCE AND TECHNOLOGY CO LTDc§§
126@9285§1§3@683757§EBBS§SCCNCN§8259682§NANJING BOERLESHIPIN CO LTD§§
126@9285§1§3@685890§RLS§SCCNCN§01436236§*NANJING BOERLESHIPIN CO LTD§§
126@9286§1§3@683758§EBBS§SCCNCN§8033390§NANJING HUAJIUMING CO LTD§§
126@9287§1§3@683759§EBBS§SCCNCN§7751990§NANJING RUIAN ELECTRIC CO LTD§§
126@9287§1§3@688171§RLS§SCCNCN§01330977§*NANJING RUIAN ELECTRIC CO LTD§§
126@9288§1§3@683760§EBBS§SCCNCN§7374267§NINGBO CITY XIANG NING AUTO TRADE LIMITED LIABILITY COMPANY§§
126@9289§1§3@683761§EBBS§SCCNCN§7754450§SHANGHAI DAJIANG JINGGONGTANG DESIGN CO LTD§§
126@929@§1§30683762§EBBS§SCCNCN§7434448§TIAN JIN SHI BEI FA YUAN SHANG MAO CO LTD§§
126@929@§1§30695851§RLS§SCCNCN§01265563§*TIAN JIN SHI BEI FA YUAN SHANG MAO CO LTD§§
126@9291§1§3@683763§EBBS§SCCNCN§8150877§XIAMEN HONGSHUO INDUSTRIAL AND TRADING CO LTD§§
126@314@§1§30674294§OAF§SCCNCN§0§CHANGZHOUSHI HONGLU ZHUTIE JIANCHANG§§
126@314@§1§30674293§EBBS§SCCNCN§8947562§CHANGZHOUSHI HONGLU ZHUTIE JIANCHANG§§
126@94@5§1§30683877§EBBS§SCCNCN§8249253§DONG GUAN SHI HONG LI TONG XIAN LAN YOU XIAN GONG SI§§
126@94@6§1§30683878§EBBS§SCCNCN§7383878§HANG ZHOU RUI CHUANG ZI DONG HUA SHE BEI CO LTD§§
麻烦热心的网友有时间帮忙看下,提供些意见,我觉得阿三给出的txt文件再把里面字符'§'替换成别的也挺麻烦的,有没有更好的办法。 |
|