将数据插入两个或多个表中

时间:2014-06-02 08:22:51

标签: sql oracle loader

我有一个关于将带有SQL LOADER的数据插入到两个或多个表中的ORACLE表的问题 但错误显示如下,

SQL*Loader-350: Syntax error at line 22.
Expecting keyword INTO, found keyword append.
APPEND INTO TABLE "FABRICATION"
^

Loader is finished

和CTL文件是,

-- THIS IS TO LOAD DATA INTO MASTER_DRAWING
LOAD DATA
INFILE "C:\Component Folder\POWERHOUSEASSYLIST.csv" 
BADFILE "POWERHOUSEASSYLIST.bad" 
DISCARDFILE "POWERHOUSEASSYLIST.dsc"

APPEND INTO TABLE "MASTER_DRAWING"
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
( 
HEAD_MARK,
PROJECT_NAME,
QTY,
COMP_TYPE,
PROFILE,
LENGTH,
SURFACE,
WEIGHT,
REV_DATE "SYSDATE",
REV_NO "1"
)

APPEND INTO TABLE "FABRICATION"
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
( 
HEAD_MARK,
PROJECT_NAME,
ID,
MARKING "0",
CUTTING "0",
ASSEMBLY "0",
WELDING "0",
DRILLING "0",
FINISHING "0",
REV_DATE "SYSDATE",
)

请帮助我,我在这里做错了什么?

1 个答案:

答案 0 :(得分:0)

你有一些小错误。

  1. APPEND INTO TABLE "FABRICATION"不需要append;
  2. REV_DATE "SYSDATE",之后有一个逗号错误。

    LOAD DATA
    INFILE "C:\Component Folder\POWERHOUSEASSYLIST.csv" 
    BADFILE "POWERHOUSEASSYLIST.bad" 
    DISCARDFILE "POWERHOUSEASSYLIST.dsc"
    
    APPEND
    INTO TABLE "MASTER_DRAWING"
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
    ( 
    HEAD_MARK,
    PROJECT_NAME,
    QTY,
    COMP_TYPE,
    PROFILE,
    LENGTH,
    SURFACE,
    WEIGHT,
    REV_DATE "SYSDATE",
    REV_NO "1"
    )
    
    INTO TABLE "FABRICATION"
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
    ( 
    HEAD_MARK,
    PROJECT_NAME,
    ID,
    MARKING "0",
    CUTTING "0",
    ASSEMBLY "0",
    WELDING "0",
    DRILLING "0",
    FINISHING "0",
    REV_DATE "SYSDATE"
    )