当前位置: 代码迷 >> Oracle管理 >> sqlldr?该如何解决
  详细解决方案

sqlldr?该如何解决

热度:645   发布时间:2016-04-24 05:20:08.0
sqlldr??
SQL code
"ID","EMAIL","PASSWORD","CONFPASSOWRD","SEX","USERNAME""206","zhangshaoqi55@163.com","86847wse","86847wse","2","杨雪莲""207","zhangzifang.happy@163.com","6741s2yi","6741s2yi","0","宋春雨""156","xiebaxing@sina.com","leisqiang","leisqiang","2","王颖""157","zhaoyilun@yahoo.cn","821s155","8211s55","2","林格格"


SQL code
OPTIONS (skip=1,rows=5) -- sqlldr 命令显示的选项可以写到这里边来,skip=1 用来跳过数据中的LOAD DATA INFILE "g://12.csv"  --指定外部数据文件,可以写多个 INFILE "another_data_file.csv" 指定多个数据文件append INTO TABLE xgs_registerFields terminated by "," -- 数据中每行记录用 "," 分隔Optionally enclosed by '"' -- 数据中每个字段用 '"' 框起,比如字段中有 "," 分隔符时trailing nullcols --表的字段没有对应的值时允许为空(        id number,    EMAIL VARCHAR2(100),--邮箱    PASSWORD VARCHAR2(300),--密码    EMAILPASSOWRD VARCHAR2(30),--邮箱密码    SEX number,--性别    USERNAME VARCHAR2(30)--用户名)

执行报下面的错 

G:\Documents and Settings\fuyou>sqlldr fuyou/fuyou control="g://xgs.ctl" log
="g://log.log"

SQL*Loader: Release 9.2.0.1.0 - Production on 星期二 10月 13 10:57:48 2009

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL*Loader-350: 语法错误位于第11行。
预期值是","或")",而实际值是"number"。
  id number,
  ^



------解决方案--------------------
你把数据类型去掉~~~~~

OPTIONS (skip=1,rows=5) -- sqlldr 命令显示的选项可以写到这里边来,skip=1 用来跳过数据中的
LOAD DATA 
INFILE "g://12.csv" --指定外部数据文件,可以写多个 INFILE "another_data_file.csv" 指定多个数据文件
append 
INTO TABLE xgs_register
Fields terminated by "," -- 数据中每行记录用 "," 分隔
Optionally enclosed by '"' -- 数据中每个字段用 '"' 框起,比如字段中有 "," 分隔符时
trailing nullcols --表的字段没有对应的值时允许为空
(

id,
EMAIL,--邮箱
PASSWORD,--密码
EMAILPASSOWRD,--邮箱密码
SEX,--性别
USERNAME--用户名

)