How to insert a timestamp in Oracle?

后端 未结 10 1720
广开言路
广开言路 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条回答
  •  Happy的楠姐
    2020-12-23 03:08

    insert
    into tablename (timestamp_value)
    values (TO_TIMESTAMP(:ts_val, 'YYYY-MM-DD HH24:MI:SS'));
    

    if you want the current time stamp to be inserted then:

    insert
    into tablename (timestamp_value)
    values (CURRENT_TIMESTAMP);
    

提交回复
热议问题