SQL Loader 将 .CSV 文件加载到 Oracle 12c 表时出现问题

问题描述 投票:0回答:0

我在 Linux 环境中尝试从 .CSV 文件加载 oracle 12c 表时遇到错误。

控制文件:

load data
infile '/opt/Infor/Marketing/10.1.0.0/custom/OUTBOUND_SPAM_COMPLAINTS_20230_TEST1.CSV' "str ';\r\n'"
badfile 'spam.bad'
append
into table EM10SCHEMA.UNSUBSCRIBEENTRY_STAGE
fields terminated by "," OPTIONALLY ENCLOSED BY '""'
TRAILING NULLCOLS
(EMAIL char(4000), created "to_date(:CREATED,'ddmmyyyy hh24:mi:ss')", UNSUBSCRIBED, ID, MODIFIED

.CSV 数据示例:

EMAIL,CREATED,UNSUBSCRIBED,ID,MODIFIED
"[email protected]","2022-06-23 07:26:38","Y","263115","2022-06-23 07:29:25"

错误日志:

SQL*Loader: Release 12.2.0.1.0 - Production on Wed Mar 1 23:35:13 2023

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

Control File:   /opt/Infor/Marketing/10.1.0.0/custom/spam_complaints.ldr
Data File:      /opt/Infor/Marketing/10.1.0.0/custom/OUTBOUND_SPAM_COMPLAINTS_20230_TEST1.CSV
  File processing option string: "str ';^M
'"
  Bad File:     spam.bad
  Discard File:  none specified

 (Allow all discards)

Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array:     64 rows, maximum of 256000 bytes
Continuation:    none specified
Path used:      Conventional

Table EM10SCHEMA.UNSUBSCRIBEENTRY_STAGE, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect

   Column Name                  Position   Len  Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
EMAIL                               FIRST  4000   ,       CHARACTER
    Enclosure string : '""'
CREATED                              NEXT     *   ,       CHARACTER
    Enclosure string : '""'
    SQL string for column : "to_date(:CREATED,'ddmmyyyy hh24:mi:ss')"
UNSUBSCRIBED                         NEXT     *   ,       CHARACTER
    Enclosure string : '""'
ID                                   NEXT     *   ,       CHARACTER
    Enclosure string : '""'
MODIFIED                             NEXT     *   ,       CHARACTER
    Enclosure string : '""'

value used for ROWS parameter changed from 64 to 50
Record 1: Rejected - Error on table EM10SCHEMA.UNSUBSCRIBEENTRY_STAGE, column CREATED.
ORA-01858: a non-numeric character was found where a numeric was expected

任何有关如何修复 SQLLDR 错误的反馈都将不胜感激。

谢谢, 软

将 .CSV 数据加载到 oracle 表中(参见下面的 DDL)

EMAIL         VARCHAR2(255 BYTE)              NOT NULL,
CREATED       DATE,
UNSUBSCRIBED  CHAR(1 BYTE)                    NOT NULL,
ID            NUMBER(19)                      NOT NULL,
MODIFIED      DATE                            NOT NULL

谢谢, 软

oracle sql-loader
© www.soinside.com 2019 - 2024. All rights reserved.