Hi,
I’m a grounchy oracle programmer who has been working with Oracle for 14 years. I’m grouchy since I typed in a long description, and hit the ESC key, as I do in vi, and my whole post disappeared. Anyway, here it is again: Oracle stores dates as a seven byte data structure with the bytes being century,year,month,day,hour,minute,second. It store them that way since most applications report dates using some combination of those instead of the number of seconds since 1/1/1970. You want to store a timestamp down to some fraction of a second. If you’re planning on sorting you’re data in Oracle based on this timestamp, it would be a good idea to store it as a numeric offset from so fixed epoch, such as 1/1/1970 or 1/1/1900. The column can be created thusly:
create table bla_bla(
.
.
.
creation_ts number
.
.
.
);
If you want to impose some precision of that number, do “number(*,3)” which means three digits to the right of the decimal. To insert data, something like the following will do
insert into table bla_bla(…,creation_ts,…)
values(…,(to_date(:our_time,‘YYYYMMDDHH24MISS’)
-to_date(:the_epoch,'YYYYMMDDHH24MISS))*86400
+:our_fraction_of_a_second,…);
Subtracting dates in oracle results in the number of days between the two dates. 86400 is the number of seconds in a day. To simplify this a bit, you can create a package on the database, and call it to insert/update the data. You may look at $ORACLE_HOME/rdbms/admin/dbmsutil.sql for the get_time function. That one gives you the number of 100ths of a second since some arbitrary epoch. Your package could have some initialization pl/sql that translates that to your epoch. Your programmer can, of course, compute the offset from you epoch, and just insert that into you number field.
Hope this helps, if you give me more description of what you use this data for, I can give more info.