Home » Developer & Programmer » Forms » calculation (forms 6i)
calculation [message #343053] Tue, 26 August 2008 01:58 Go to next message
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 #343075 is a reply to message #343053] Tue, 26 August 2008 04:00 Go to previous messageGo to next message
mudabbir
Messages: 235
Registered: April 2006
Location: Kuwait
Senior Member

what if it is 5:45 , 5:54?
Re: calculation [message #343099 is a reply to message #343075] Tue, 26 August 2008 05:03 Go to previous messageGo to next message
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 Go to previous messageGo to next message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

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)

Re: calculation [message #343317 is a reply to message #343293] Tue, 26 August 2008 23:13 Go to previous messageGo to next message
sajidrazmi
Messages: 47
Registered: August 2008
Location: oman
Member
Thanks wency
I have done it my self
but thank you very much for giving me this code.
Re: calculation [message #343319 is a reply to message #343317] Tue, 26 August 2008 23:19 Go to previous message
cvs_1984
Messages: 136
Registered: August 2007
Location: Punjab, INDIA
Senior Member

I want to know How to take your final Report.

That may be useful to me also

Regards

CVS
Previous Topic: running sum based on feild value
Next Topic: unable to update column
Goto Forum:
  


Current Time: Thu Dec 08 02:03:10 CST 2016

Total time taken to generate the page: 0.16427 seconds