sqldr load 以及extract data 的中文问题--

来源:互联网 发布:天行VPN软件下载 编辑:程序博客网 时间:2024/05/15 08:59
sqldr load 问题:
问题:
1,无法upload,没有明显的问题
2,进入database,中文显示乱码,premise:data  (csv  file ) is saved  as utf-8, and in database(oracle) ,the encoding is alos utf-8.
3,要upload 的资料(csv file)中有部分中文

解决: control file:(added the line in blue , then everything is ok !!!)

OPTIONS (skip=1, errors=9999)
load data
CHARACTERSET UTF8
replace
into table product_special_position_kw
WHEN keyword != '' AND spp_rank != ''
fields terminated by ',' optionally enclosed by '"'
trailing nullcols
(
  product_id,
  start_date date "dd-Mon-YY",
  end_date date "dd-Mon-YY",
  action FILLER,
  spp_rank,
  keyword char(200) "SUBSTR(TRIM(:keyword), 1, 200)",
  keywordzx char(200) "SUBSTR(TRIM(:keywordzx), 1, 200)"
)

extract data 问题:
问题:把数据从oracle DB 写 到csv file, 如果有中文的话,会出现乱码。
解决:set enviroment first.
setenv.sh
##Normal maybe
#en_US.UTF-8

##Use below for CN inputs
export NLS_LANG='AMERICAN_AMERICA.UTF8'
#export NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16CGB231280'

extract 之前,先执行setenv.sh
原创粉丝点击