Mike Rifgin Mike Rifgin - 28 days ago 5
SQL Question

How to insert a timestamp in Oracle?

I have an Oracle DB with a

timestamp
field in it. What is the correct SQL code to insert a
timestamp
into this field?

Answer
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);