当日期列有两位数小时时,外部表失败

时间:2015-11-10 22:17:48

标签: oracle11g external-tables

我在Oracle 11g中使用外部表。我在文件的最后一列中有一个日期字段。我将其解析为表定义中的TIMESTAMP列:

CREATE TABLE e_tbl_one
(
FOPV_KEY            INTEGER,
FACILITY            VARCHAR2(50),
QTY_6HR             NUMBER,
SECURITY_CODE       NUMBER,
LOAD_DATE          TIMESTAMP(0) WITH LOCAL TIME ZONE
)
ORGANIZATION EXTERNAL
  (  TYPE ORACLE_LOADER
     DEFAULT DIRECTORY MYDB_EXTERNAL_TABLE_DATA
     ACCESS PARAMETERS 
       ( records delimited by newline SKIP 1
         NOBADFILE
         NOLOGFILE
         fields terminated by '|' 
         missing field values are null 
         (
          FOPV_KEY,
          FACILITY,
          QTY_6HR,
          SECURITY_CODE,
          LOAD_DATE date 'mm/dd/yyyy hh:mi:ss am'
         )
  )
     LOCATION (MYDB_EXTERNAL_TABLE_DATA:'e_tbl_one.txt')
  )
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;

这将解析日期11/10/2015 1:59:37 PM,但不会解析11/10/2015 01:59:37 PM11/10/2015 12:45:12 PM

日志文件显示:

KUP-04021: field formatting error for field LOAD_DATE
KUP-04026: field too long for datatype
KUP-04101: record 2 rejected in file /dbfs_direct/FS1/MYDB_EXTERNAL_TABLE/e_tbl_one.txt

此时LOAD_DATE的数据为:11/11/2015 07:28:36 am。文本文件中的记录是:

70581692|WS3|308|2048|11/11/2015 07:41:00 am[CRLF]

为什么不能将其解析为LOAD_DATE date 'mm/dd/yyyy hh:mi:ss am'

0 个答案:

没有答案