带有= condition的“WHEN”子句在使用SQL LOADER时对于字符数据失败

时间:2017-05-30 11:19:46

标签: sql-loader

csv数据

NAME,SALARY
XXX,10000
YYY,20100

CTL文件

 OPTIONS (SKIP=1)
  load data
  infile '&1'
  APPEND
  into table temp_employee2
  WHEN ENAME = 'XXX'
  fields terminated by ","    
  (
    ENAME,
    SALARY
  )

在运行cp时,它会转到警告,包含所有记录

 Table TEMP_EMPLOYEE2, loaded when ENAME = 0X585858(character 'XXX')
  Insert option in effect for this table: APPEND

       Column Name                  Position   Len  Term Encl Datatype
    ------------------------------ ---------- ----- ---- ---- ---------------------
   ENAME                               FIRST     *   ,       CHARACTER            
   SALARY                               NEXT     *   ,       CHARACTER            

  Record 0: Discarded - failed all WHEN clauses.
  Record 1: Discarded - failed all WHEN clauses.

 Table TEMP_EMPLOYEE2:
    0 Rows successfully loaded.
    0 Rows not loaded due to data errors.
    1 Row not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.

为绑定数组分配的空间:33024字节(64行) 读缓冲区字节:1048576

跳过总逻辑记录:1 读取的逻辑记录总数:1 拒绝的逻辑记录总数:0 丢弃的逻辑记录总数:2

1 个答案:

答案 0 :(得分:0)

由于我使用了OPTIONS(SKIP = 1),加载器会跳过满足when条件的第1行,我只有1行满足when条件,所以数据没有加载到表中。