oracle 在 SQL*Loader 控制文件中设置日期格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16595545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Setting the Date Format in the SQL*Loader Control File
提问by Angelina
I have csv file that has "17 September, 2009 11:06:06 AM" as COMPLETED_ON variable
我有一个 csv 文件,其中包含“2009 年 9 月 17 日上午 11:06:06”作为 COMPLETED_ON 变量
I am using sql loader to load data to oracle with folowing:
我正在使用 sql loader 将数据加载到 oracle,如下所示:
LOAD DATA
INFILE 'c:/load/file_name.csv'
APPEND
INTO TABLE tbl_name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(
COMPLETED_ON DATE "not sure what to put here",
)
in oracle I have this column created as follows:
在 oracle 中,我按如下方式创建了此列:
"COMPLETED_ON" TIMESTAMP (0) WITH LOCAL TIME ZONE
“COMPLETED_ON”时间戳 (0) 带本地时区
How do I change COMPLETED_ON date in control file?
如何更改控制文件中的 COMPLETED_ON 日期?
回答by Ed Gibbs
I'm not 100% with the LOAD DATA INFILE
syntax, but I know the format string 'DD Month, YYYY HH:MI:SS AM'
matches your date format. I was able to use it in a TO_DATE
to convert your sample date. Try this:
我不是 100% 使用LOAD DATA INFILE
语法,但我知道格式字符串'DD Month, YYYY HH:MI:SS AM'
与您的日期格式相匹配。我能够在 a 中使用它TO_DATE
来转换您的示例日期。尝试这个:
LOAD DATA
INFILE 'c:/load/CW_COMPLIANCE.csv'
APPEND
INTO TABLE tbl_name
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
(
COMPLETED_ON DATE 'DD Month, YYYY HH:MI:SS AM',
)