Oracle 中的时间戳转换为 YYYY-MM-DD HH:MM:SS 格式

2021-12-30 00:00:00 sql oracle11g oracle sql-timestamp

我正在尝试将 YYYY-MM-DD HH:MM:SS 格式的记录从 Netezza 插入 Oracle,但我得到的日期类型无效.

I'm trying to insert records with YYYY-MM-DD HH:MM:SS format into Oracle from Netezza, but I'm getting invalid date type.

我怎样才能做到这一点?

How can I accomplish this one?

CREATE TABLE AM_PROGRAM_TUNING_EVENT_TMP1
(
    ST TIMESTAMP,
    ET TIMESTAMP,
    MAS_DIV_KEY INTEGER NOT NULL,
    SBSC_GUID_KEY INTEGER NOT NULL,
    STN_KEY INTEGER NOT NULL
 );


INSERT INTO  AM_PROGRAM_TUNING_EVENT_TMP1 VALUES('2012-03-28 11:10:00','2012-03-28 11:30:00',1,3636815,151);

推荐答案

INSERT INTO AM_PROGRAM_TUNING_EVENT_TMP1 
VALUES(TO_DATE('2012-03-28 11:10:00','yyyy/mm/dd hh24:mi:ss'));

http://www.sqlfiddle.com/#!4/22115/1

相关文章