how to insert date and time in oracle?

前端 未结 5 929
清歌不尽
清歌不尽 2020-12-08 00:23

Im having trouble inserting a row in my table. Here is the insert statement and table creation. This is part of a uni assignment hence the simplicity, what am i doing wrong?

5条回答
  •  攒了一身酷
    2020-12-08 00:50

    You are doing everything right by using a to_date function and specifying the time. The time is there in the database. The trouble is just that when you select a column of DATE datatype from the database, the default format mask doesn't show the time. If you issue a

    alter session set nls_date_format = 'dd/MON/yyyy hh24:mi:ss'

    or something similar including a time component, you will see that the time successfully made it into the database.

提交回复
热议问题