Welcome Guest ( Log In | Register )


 
 
 
 
 
 

 
 
Oracle 

Performance Tuning Reference poster
 
Oracle training in Linux 

commands
 
Oracle training Weblogic Book
 
Easy Oracle Jumpstart
 
Oracle training & performance tuning books
 
Burleson Consulting Remote DB Administration
 
 
 
Reply to this topicStart new topic
> Adding milliseconds to a timestamp
Omer Alvi
post Mar 28 2007, 09:18 AM
Post #1


Newbie
*

Group: Members
Posts: 5
Joined: 28-March 07
Member No.: 7,787



Hi all

I want to add milliseconds to my timestamp object. For example I have to increment the timestamp value by 25 milliseconds in each iteration of a loop. Is there any way to do that?

Cheers
Go to the top of the page
 
+Quote Post
burleson
post Mar 28 2007, 09:54 AM
Post #2


Advanced Member
***

Group: Members
Posts: 11,485
Joined: 26-January 04
Member No.: 13



Hi,

>> I have to increment the timestamp value by 25 milliseconds in each iteration of a loop.

Sure, Mike Ault has an example here of incrementing a timestamp:

http://www.dba-oracle.com/t_timespamp_math_elapsed_times.htm


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
Omer Alvi
post Mar 28 2007, 05:36 PM
Post #3


Newbie
*

Group: Members
Posts: 5
Joined: 28-March 07
Member No.: 7,787



Hi Burleson,



QUOTE (burleson @ Mar 28 2007, 03:55 PM) *
Hi,

>> I have to increment the timestamp value by 25 milliseconds in each iteration of a loop.

Sure, Mike Ault has an example here of incrementing a timestamp:

http://www.dba-oracle.com/t_timespamp_math_elapsed_times.htm





Thanks for your reply.I really appreciate that. Your suggested article helped me in converting a timestamp into milliseconds, but I still could not get how to increment the time stamp value by milliseconds (e.g., 25 milliseconds).

Best regards,
Go to the top of the page
 
+Quote Post
burleson
post Mar 29 2007, 01:20 PM
Post #4


Advanced Member
***

Group: Members
Posts: 11,485
Joined: 26-January 04
Member No.: 13



Hi,

The article shows working code for getting the millisecond difference between two timezone columns, right?

http://www.dba-oracle.com/t_timespamp_math_elapsed_times.htm

"So now we can get the milliseconds between . . . "


--------------------
Hope this helps. . .

Donald K. Burleson
Oracle Press author
Author of Oracle Tuning: The Definitive Reference
Go to the top of the page
 
+Quote Post
Omer Alvi
post Mar 30 2007, 02:54 AM
Post #5


Newbie
*

Group: Members
Posts: 5
Joined: 28-March 07
Member No.: 7,787



QUOTE (burleson @ Mar 29 2007, 07:21 PM) *
Hi,

The article shows working code for getting the millisecond difference between two timezone columns, right?

http://www.dba-oracle.com/t_timespamp_math_elapsed_times.htm

"So now we can get the milliseconds between . . . "



Dear Burleson,

I am sorry I could not put my question properly. Lemme put it this way. After converting a timestamp into milliseconds and then adding some milliseconds in that value, Can we convert those milliseconds into a new timestamp ?
Go to the top of the page
 
+Quote Post
Manfred
post Mar 30 2007, 03:58 AM
Post #6


Advanced Member
***

Group: Members
Posts: 119
Joined: 23-March 05
From: Switzerland
Member No.: 1,696



Hi Omer

Take the followin as an example:

select to_char(systimestamp,'dd-mm-yyyy hh24:mi:ss.FF') as ts
, to_timestamp(to_char(sysdate,'dd-mm-yyyy hh24:mi:ss.')||to_char(to_number(to_char(systimestamp,'FF')) + 250)
,'dd-mm-yyyy hh24:mi:ss.FF') as ts_1
from dual;

Looks screwy and it is probably not usefull using all this conversions, but it works!

Regrads

Manfred biggrin.gif
Go to the top of the page
 
+Quote Post
Omer Alvi
post Mar 30 2007, 05:49 AM
Post #7


Newbie
*

Group: Members
Posts: 5
Joined: 28-March 07
Member No.: 7,787



QUOTE (Manfred @ Mar 30 2007, 09:59 AM) *
Hi Omer

Take the followin as an example:

select to_char(systimestamp,'dd-mm-yyyy hh24:mi:ss.FF') as ts
, to_timestamp(to_char(sysdate,'dd-mm-yyyy hh24:mi:ss.')||to_char(to_number(to_char(systimestamp,'FF')) + 250)
,'dd-mm-yyyy hh24:mi:ss.FF') as ts_1
from dual;

Looks screwy and it is probably not usefull using all this conversions, but it works!

Regrads

Manfred biggrin.gif


Thanks Manfred. Yes it works and increases milliseconds. But it does not affect the seconds field. For example if we add 1000 millisecods then ideally the seconds field should be incremented. We know there is way to convert a timestamp into milliseconds. Is there any way to convert the milliseconds back to timestamp ? Or if ther is any way of adding milliseconds to the timestamp object which does reflect changes in seconds filed?

Thank you very much for your help.

Best regards
Go to the top of the page
 
+Quote Post
HariS
post May 4 2007, 02:08 AM
Post #8


Newbie
*

Group: Members
Posts: 1
Joined: 4-May 07
Member No.: 8,442



I used the numtodsinterval like:

select systimestamp, systimestamp+numtodsinterval(0.33,'SECOND') from dual;



QUOTE (Omer Alvi @ Mar 30 2007, 12:50 PM) *
Thanks Manfred. Yes it works and increases milliseconds. But it does not affect the seconds field. For example if we add 1000 millisecods then ideally the seconds field should be incremented. We know there is way to convert a timestamp into milliseconds. Is there any way to convert the milliseconds back to timestamp ? Or if ther is any way of adding milliseconds to the timestamp object which does reflect changes in seconds filed?

Thank you very much for your help.

Best regards
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th September 2014 - 04:43 PM