function to convert string to number
443975Oct 17 2005 — edited Oct 19 2005Hi there,
I wrote a function which converted a hor minute component of a date to a number. Now I need to do the same with a string (because the hours could be more then 23:95). Anyway here is my function. How can I rewrite it so it will accept a string as in parameter. Somwhow I can not work it out. Thanks a lot.
Chris
function calculate_hours_project(in_hours in DATE)
RETURN number
AS
hrs CHAR(2);
mins CHAR(2);
BEGIN
hrs := to_char(in_day, 'HH24');
mins := to_char(in_day, 'MI');
if hrs is not null and mins is not null then
RETURN to_number(hrs + (mins/60));
else
RETURN 0;
end if;
END calculate_hours_project;