Home » SQL & PL/SQL » SQL & PL/SQL » default behaviour of timestamp
default behaviour of timestamp [message #269967] Tue, 25 September 2007 04:49 Go to next message
karismapanda
Messages: 58
Registered: January 2007
Member
Hi,

I have a table with a column of timestamp data type.
SQL> desc test
Name Null? Type
----------------------------------------- -------- ----------------------------
C_TIME TIMESTAMP(3)

when i am inserting a record its rounding off the fractional second part.

like........


SQL> insert into test values('2007/09/25 03:03:36:14568 PM');

1 row created.

SQL> select * from test;

C_TIME
---------------------------------------------------------------------------
2007/09/25 03:03:36:146000 PM

i need the o/p to be like

2007/09/25 03:03:36:145000 PM


is it the default behaviour or we can do some db level setting so that instead of rounding it will truncate it.

Thanks
Re: default behaviour of timestamp [message #269970 is a reply to message #269967] Tue, 25 September 2007 04:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
First,
Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Then,
You column is defined as TIMESTAMP(3), so timestamp is rounded to the third decimal, this is the correct behaviour.
If you want the data to be truncated then you have to do it yourself.

By the way:
insert into test values('2007/09/25 03:03:36:14568 PM');
Is not a valid statement everywhere and everytime, you have to use TO_TIMESTAMP function.

Regards
Michel

[Updated on: Tue, 25 September 2007 04:57]

Report message to a moderator

Re: default behaviour of timestamp [message #269981 is a reply to message #269970] Tue, 25 September 2007 05:13 Go to previous message
karismapanda
Messages: 58
Registered: January 2007
Member
surely,i will keep in mind.
thanks a lot
Previous Topic: Error Handling
Next Topic: Row to Column conversion
Goto Forum:
  


Current Time: Wed Dec 07 16:41:24 CST 2016

Total time taken to generate the page: 0.10379 seconds