How to insert a timestamp in Oracle?
Solution 1:
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);
Solution 2:
INSERT
INTO mytable (timestamp_field)
VALUES (CURRENT_TIMESTAMP)
CURRENT_TIMESTAMP
and SYSTIMESTAMP
are Oracle reserved words for this purpose. They are the timestamp analog of SYSDATE
.