Home » SQL & PL/SQL » SQL & PL/SQL » How to add millisecond to TIMESTAMP datatype value
How to add millisecond to TIMESTAMP datatype value [message #253893] Wed, 25 July 2007 04:32 Go to next message
himang
Messages: 282
Registered: March 2005
Location: Bangalore
Senior Member

Hi,
How can I add 1 millisecond to a TIMESTAMP datatype value. I have a column having TIMESTAMP as datatype. To the value I want to add 1 millisecond, how can I achieve this?

Regards
Re: How to add millisecond to TIMESTAMP datatype value [message #253895 is a reply to message #253893] Wed, 25 July 2007 04:43 Go to previous messageGo to next message
himang
Messages: 282
Registered: March 2005
Location: Bangalore
Senior Member

Got a wayaround -

SELECT
TO_TIMESTAMP(to_char(action_date,'DD-MON-YYYY HH24:MI:') || (extract(second from action_date) + 0.000001),'DD-MON-YYYY HH24:MI:SS:ff') FROM table1;

<action_date> is TIMESTAMP type.

Is there any better way? Razz

Regards
Himanshu
Re: How to add millisecond to TIMESTAMP datatype value [message #253915 is a reply to message #253893] Wed, 25 July 2007 05:25 Go to previous messageGo to next message
Michel Cadot
Messages: 64137
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> select systimestamp, systimestamp+interval '0.001' second plus1ms from dual;
SYSTIMESTAMP
---------------------------------------------------------------------------
PLUS1MS
---------------------------------------------------------------------------
25/07/2007 12:25:11.427 +02:00
25/07/2007 12:25:11.428 +02:00

1 row selected.

Regards
Michel
Re: How to add millisecond to TIMESTAMP datatype value [message #254252 is a reply to message #253893] Thu, 26 July 2007 05:25 Go to previous message
himang
Messages: 282
Registered: March 2005
Location: Bangalore
Senior Member

Cool.. thanx. I tried that but somehow I was missing something I suppose as I was getting error.
Previous Topic: Cursor Vs Subquery
Next Topic: query
Goto Forum:
  


Current Time: Thu Dec 08 06:20:32 CST 2016

Total time taken to generate the page: 0.10567 seconds