Home » SQL & PL/SQL » SQL & PL/SQL » Convert Number to hours or minutes (oracle 8.0)
Convert Number to hours or minutes Sun, 20 July 2008 22:07
 ap_karthi Messages: 87Registered: October 2007 Location: Bangalore Member
Hi All,

I've a number field, if I sum up, the total is 70.85.
Now I need to convert this into hours, so the output should be as 73.05hrs (70 + 85(3hrs & 5 mins)).
As I'm using oracle8, so latest functions not working. Let me know if anyother method. Thank you.

-Karthik
Re: Convert Number to hours or minutes [message #335084 is a reply to message #335083] Sun, 20 July 2008 22:11
 BlackSwan Messages: 25474Registered: January 2009 Location: SoCal Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow the Posting Guidelines as stated in URL above

>73.05hrs (70 + 85(3hrs & 5 mins)).
HUH???????????????????????????????
by what transliteration does 85 become 3 hours & 5 minutes

[Updated on: Sun, 20 July 2008 22:12] by Moderator

Report message to a moderator

Re: Convert Number to hours or minutes [message #335087 is a reply to message #335084] Sun, 20 July 2008 23:07
 ap_karthi Messages: 87Registered: October 2007 Location: Bangalore Member
Really sorry,

Its a mistake, it should be as...
= 70.85
= 70hrs + 0.85mins
= 70 + (1hr + 25mins)
= 71.25hrs.
Re: Convert Number to hours or minutes [message #335089 is a reply to message #335087] Sun, 20 July 2008 23:13
 BlackSwan Messages: 25474Registered: January 2009 Location: SoCal Senior Member
 ap_karthi wrote on Sun, 20 July 2008 21:07 Really sorry, Its a mistake, it should be as... = 70.85 = 70hrs + 0.85mins = 70 + (1hr + 25mins) = 71.25hrs.

You have the mathematics, now execute in SQL.
Re: Convert Number to hours or minutes [message #335105 is a reply to message #335087] Mon, 21 July 2008 00:53
 Michel Cadot Messages: 64953Registered: March 2007 Location: Nanterre, France, http://... Senior MemberAccount Moderator
TRUNC and MOD functions are what you need.

Regards
Michel
Re: Convert Number to hours or minutes [message #335137 is a reply to message #335105] Mon, 21 July 2008 03:27
 JRowbottom Messages: 5933Registered: June 2006 Location: Sunny North Yorkshire, ho... Senior Member
I'd have used Floor rather than TRUNC - I think it makes t more obvious what the process is doing, but there's nothing to choose between them in functional terms.
 Previous Topic: How to add storage parameters after creation of table for LOB column Next Topic: Reading values from a delimited line
Goto Forum:

Current Time: Sat Jun 24 14:12:41 CDT 2017

Total time taken to generate the page: 0.05510 seconds