Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to calculate a string (select '1 + 1' from dual;)

387548May 22 2006 — edited May 22 2006
I have this system that gives me data (roughly a gig per hour) in the format:
Time_idle
13h 56m
56m 23s
24h 23m
4h 3m
4m 3s

I have to translate it into date, or desimal hour so I can use it in calculations and SQL.

How can I do this?

I have tried the following:

select RTRIM(REPLACE(REPLACE(REPLACE(REPLACE(time_idle,'h',''),'m','/60'),'s','/3600'),' ','+'),'+') from thedate where prosess = 1;

and I then get:

result:
10+54/60
14+12/60
54/60+1/3600

which is correct, if I could get Oracle to calculate the number sum instead of just providing me with the string value. How do I make Oracle calculate the value of the string?

Or how can I use to_date function to translate the text into a date?

Anyone know?

BB
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2006
Added on May 22 2006
6 comments
468 views