Normally, however, it is more useful to have either the INTERVAL DAY TO SECOND representation or to have separate columns for hours, minutes, seconds, etc. You can then convert each of those components into milliseconds and add them up SQL> edġ select extract( day from diff )*24*60*60*1000 +Ĥ round(extract( second from diff )*1000) total_milliseconds You can use the EXTRACT function to extract the individual elements of an INTERVAL DAY TO SECOND SQL> edĥ from (select systimestamp - to_timestamp( '', 'yyyy-mm-dd' ) diff SYSTIMESTAMP-TO_TIMESTAMP('','YYYY-MM-DD') 1 select systimestamp - to_timestamp( '', 'yyyy-mm-dd' ) If the database is running on Unix, systimestamp will generally have microseconds. If the database is running on Windows, systimestamp will generally have milliseconds. When you subtract two variables of type TIMESTAMP, you get an INTERVAL DAY TO SECOND which includes a number of milliseconds and/or microseconds depending on the platform.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |