0

我有一个 Oracle SQL*Loader。我需要在 Oracle 数据库中插入大量记录。这是我的 .ctl 文件:

OPTIONS (DIRECT=TRUE)                           
     UNRECOVERABLE                          
     LOAD DATA                                       
     CHARACTERSET WE8EBCDIC500                       
     infile * "fix 12"                             
     APPEND                                          
     INTO TABLE  IPERCAI1.TDE_MIDINERO            
     (                                               
        ACTIVA  POSITION(1:20) VARCHAR2(20),         
        TIPUSACT POSITION(21:21) VARCHAR2(1),        
        IMPREINT POSITION(22:32) NUMBER(11,2),
        NUMREINT POSITION(33:37) NUMBER(5),
        REINTEGROS_MES1 POSITION(38,48) NUMBER(11,2),
        REINTEGROS_MES2 POSITION(49,59) NUMBER(11,2),
        REINTEGROS_MES3 POSITION(60,70) NUMBER(11,2),
        REINTEGROS_MES4 POSITION(71,81) NUMBER(11,2),
        REINTEGROS_MES5 POSITION(82,92) NUMBER(11,2),
        REINTEGROS_MES6 POSITION(93,103) NUMBER(11,2),
        REINTEGROS_MES7 POSITION(104,114) NUMBER(11,2),
        REINTEGROS_MES8 POSITION(115,125) NUMBER(11,2),
        REINTEGROS_MES9 POSITION(126,136) NUMBER(11,2),
        REINTEGROS_MES10 POSITION(137,147) NUMBER(11,2),
        REINTEGROS_MES12 POSITION(148,158) NUMBER(11,2),
        ACUMULADO POSITION(159,171) NUMBER(13,2),
        IMPMAX POSITION(172,184) NUMBER(13,2),
        IMPLIMIT  POSITION(185,197) NUMBER(13,2),
        CAJERO POSITION(198,202) NUMBER(5),
        DATUDIA POSITION(203,211) NUMBER(9),
        DATUMES POSITION(212,220) NUMBER(9)
        )

我需要添加一个名为 DATULT 的新字段。该字段必须是实际的日期时间,我无法从文件中获取值。我必须计算一下。谁能告诉我如何在我的 .ctl 文件中添加这个字段?此字段必须是 Oracle 中的 DATE 类型

先感谢您!!

4

1 回答 1

0

这是解决方案:

OPTIONS (DIRECT=FALSE)
LOAD DATA
INFILE *
BADFILE *                                                          
REPLACE                                       
INTO TABLE IPERCAI1.TDE_MIDINERO            
(                                               
    ACTIVA  POSITION(1:20) CHAR(20),         
    TIPUSACT POSITION(21:21) CHAR(1),        
    IMPREINT POSITION(22:32) DECIMAL EXTERNAL(11) ":IMPREINT/100",
    NUMREINT POSITION(33:37) INTEGER EXTERNAL,
    REINTEGROS_MES1 POSITION(38:48) DECIMAL EXTERNAL(11) ":REINTEGROS_MES1/100",
    REINTEGROS_MES2 POSITION(49:59) DECIMAL EXTERNAL(11) ":REINTEGROS_MES2/100",
    REINTEGROS_MES3 POSITION(60:70) DECIMAL EXTERNAL(11) ":REINTEGROS_MES3/100",
    REINTEGROS_MES4 POSITION(71:81) DECIMAL EXTERNAL(11) ":REINTEGROS_MES4/100",
    REINTEGROS_MES5 POSITION(82:92) DECIMAL EXTERNAL(11) ":REINTEGROS_MES5/100",
    REINTEGROS_MES6 POSITION(93:103) DECIMAL EXTERNAL(11) ":REINTEGROS_MES6/100",
    REINTEGROS_MES7 POSITION(104:114) DECIMAL EXTERNAL(11) ":REINTEGROS_MES7/100",
    REINTEGROS_MES8 POSITION(115:125) DECIMAL EXTERNAL(11) ":REINTEGROS_MES8/100",
    REINTEGROS_MES9 POSITION(126:136) DECIMAL EXTERNAL(11) ":REINTEGROS_MES9/100",
    REINTEGROS_MES10 POSITION(137:147) DECIMAL EXTERNAL(11) ":REINTEGROS_MES10/100",
    REINTEGROS_MES11 POSITION(148:158) DECIMAL EXTERNAL(11) ":REINTEGROS_MES11/100",
    REINTEGROS_MES12 POSITION(159:169) DECIMAL EXTERNAL(11) ":REINTEGROS_MES12/100",
    ACUMULADO POSITION(170:182) DECIMAL EXTERNAL(13) ":ACUMULADO/100",
    IMPMAX POSITION(183:195) DECIMAL EXTERNAL(13) ":IMPMAX/100",
    IMPLIMIT POSITION(196:208) DECIMAL EXTERNAL(13) ":IMPLIMIT/100",
    DATULTM sysdate,
    CAJERO POSITION(217:221) INTEGER EXTERNAL,
    DATUDIA POSITION(222:229) INTEGER EXTERNAL,
    DATUMES POSITION(230:237) INTEGER EXTERNAL
)
于 2013-10-25T08:52:58.643 回答