How to insert a timestamp in Oracle?

后端 未结 10 1723
广开言路
广开言路 2020-12-23 02:34

I have an Oracle DB with a timestamp field in it. What is the correct SQL code to insert a timestamp into this field?

10条回答
  •  旧巷少年郎
    2020-12-23 03:31

    One can simply use

    INSERT INTO MY_TABLE(MY_TIMESTAMP_FIELD)
    VALUES (TIMESTAMP '2019-02-15 13:22:11.871+02:00');
    

    This way you won't have to worry about date format string, just use default timestamp format.

    Works with Oracle 11, have no idea if it does for earlier Oracle versions.

提交回复
热议问题