我正在过去" 19851003"作为文件中的出生日期,但我在日志文件中收到以下错误。
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
我知道为什么会出现错误,因为我只是将其作为字符串传递
日志文件错误:
error processing column DATE_OF_BIRTH in row 2 for datafile /xfer/x/directory/filename.csv
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
我的表格代码:
CREATE TABLE table_name
(
ID VARCHAR2(10 BYTE),
FIRST_NAME VARCHAR2(150 BYTE),
LAST_NAME VARCHAR2(150 BYTE),
MIDDLE_NAME VARCHAR2(150 BYTE),
DATE_OF_BIRTH DATE
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY DIRECTORY_TABLES
ACCESS PARAMETERS
(RECORDS DELIMITED BY '\n'
SKIP 1
BADFILE DIRECTORY_TABLES:'filelist.bad'
LOGFILE DIRECTORY_TABLES:'filelist.log'
DISCARDFILE DIRECTORY_TABLES:'filelist.dsc'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
(ID ,
FIRST_NAME ,
LAST_NAME ,
MIDDLE_NAME ,
DATE_OF_BIRTH DATE "YYYYMMDD"
)
)
LOCATION (DIRECTORY_TABLES:'filename.csv')
)
REJECT LIMIT 0
NOPARALLEL
NOMONITORING;
我的CSV文件:
"id","First Name","Last Name","MI","DOB"
"2","Felicia","Brown","M","19810209"
"3","Jose","Romero","M","19890706"
"4","Valerie","Moore","","19621112"
答案 0 :(得分:2)
在DATE_OF_BIRTH的规范中,需要date-format-spec。尝试:
DATE_OF_BIRTH CHAR DATE_FORMAT DATE MASK "YYYYMMDD"
Reference here然后搜索“date_format_spec”
分享并享受。
答案 1 :(得分:0)
19851003不在-4713和9999之间,就像错误所说的那样。
我怀疑你想通过1985年作为一年,你不小心通过了一个完整的约会(yyyyMmdd)