简体   繁体   中英

Oracle date column returns results in order but need to see milliseconds

As Date uses a precision only up to seconds and we need to use timestamp to have more precision (upto milliseconds).

I run a query and sort in descending order of the create_date field which returns results in right order according to transaction execution.

3 results with different transaction codes (TRN, DII, DRD) in that order, all show same create_date values (eg: 28-MAY-13 12.09.45).

I am not able to see the milliseconds, but DRD is created milliseconds before DII which is created few milliseconds before TRN.

So it does capture the creation times upto milliseconds and displays accordingly in right order, but how can I see this time? I tried:

to_timestamp(create_date, 'DD.MM.YYYY HH24:MI:SSFF3' )

but still shows 0 for milliseconds part.

Your created_date field should be of TIMESTAMP type. When inserting into this column use systimestamp instead of sysdate to store the milliseconds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM