time problem [message #78629] |
Wed, 06 March 2002 04:35 |
My cursor Pratap to clari
Messages: 1 Registered: March 2002
|
Junior Member |
|
|
function CF_1Formula return number is
v_time number(4,2) := null;
cursor get_time is
select :hrs + to_number(to_char(trunc(:mins/60)) ||'.'||to_char(mod(:mins,60)))
from dual;
begin
if :mins > 59 then
open get_time;
fetch get_time into v_time;
close get_time;
return (to_char(v_time,'99.99'));
else
v_time := to_char(nvl(:hrs,0))||'.'||to_char(nvl(:mins,0));
return (v_time);
end if;
end;
---------
/* so 1. hrs = 1 mins = 30 result 1.3 (wrong)
2. hrs = 2 mins = 64 result 3.4 (correct)
3. hrs = 0 mins = 50 result .5 (wrong) */
hope this makes things clearer!
Regards,
Nik.
|
|
|
|