calculation [message #343053] |
Tue, 26 August 2008 01:58 |
sajidrazmi
Messages: 47 Registered: August 2008 Location: oman
|
Member |
|
|
Hi Dear
i have one tabular block in this block i have lots of record .
like this
4:01 and 5:45 i have to calculate this (both field are varchar2)
i have to calculate like this
4:01 and 5:45 = 9:46 (it basically total time)
please give me solution hocould i calculate this.
thanks and regards
Sajid
|
|
|
|
Re: calculation [message #343099 is a reply to message #343075] |
Tue, 26 August 2008 05:03 |
sajidrazmi
Messages: 47 Registered: August 2008 Location: oman
|
Member |
|
|
i have to calculte total hours
i have tabular block
and one field is value like
4:01 and second field value is 5:45
i have to calculte total hours borth field are varchar2
PLEASE GIVE ME SOLUTION
[Updated on: Tue, 26 August 2008 05:45] Report message to a moderator
|
|
|
Re: calculation [message #343293 is a reply to message #343099] |
Tue, 26 August 2008 19:08 |
|
String manipulation:
SELECT t_Hour + t_Hour2,
Mod(t_mIn,60),
To_char(t_Hour + t_Hour2)
||':'
||To_char(Mod(t_mIn,60),'00')
FROM (SELECT Substr('5:45',1,Instr('5:45',':') - 1) Time1,
Substr('4:16',1,Instr('4:16',':') - 1) Time2,
Substr('5:45',Instr('5:45',':') + 1) mIn1,
Substr('4:16',Instr('4:16',':') + 1) mIn2,
To_number(Substr('5:45',1,Instr('5:45',':') - 1)) + To_number(Substr('4:16',1,Instr('4:16',':') - 1)) t_Hour,
Trunc((To_number(Substr('5:45',Instr('5:45',':') + 1)) + To_number(Substr('4:16',Instr('4:16',':') + 1))) / 60) t_Hour2,
To_number(Substr('5:45',Instr('5:45',':') + 1)) + To_number(Substr('4:16',Instr('4:16',':') + 1)) t_mIn
FROM Dual)
|
|
|
|
|