Sql – the syntax for inserting data into a timestamp(6) type field in Oracle


I need to insert some data into a table in Oracle.

The only problem is one of the fields is a timestamp(6) type and it is required data. I don't care about what actually goes in here I just need to get the right syntax for an entry so that the database will accept it.

I'm using the gui web client to enter data however I don't mind using raw SQL if I have to.


Best Solution

I dunno if this helps at all, but in SQL*Plus I did this:

create table x ( a timestamp(6));
insert into x values ( current_timestamp );
select * from x;

getting me this:

15-OCT-08 PM

So it looks like that works.

If you need to put a previously-known value into the column, how about the TO_TIMESTAMP() function? Something like this:

select to_timestamp('27/02/2002 15:51.12.539880', 'dd/mm/yyyy hh24:mi.ss.ff') 
from dual ;