Hello all,
Using Oracle 9.2 and performing this work in a function.
I'm trying to determine if the amount of time elapsed between two timestamps is of a certain value.
whole function below
Now I have these 2 variables, varStartTime and varEndTime...which contain times, i.e. 8:30 and 11:18.
How can I determine how much time, in hours, has elapsed between these two fields/..?
Thanks!
Using Oracle 9.2 and performing this work in a function.
I'm trying to determine if the amount of time elapsed between two timestamps is of a certain value.
whole function below
Code:
CREATE OR REPLACE FUNCTION FINISHTIME
(vProdid Prod.ProdID%type,
vWorkstep Route.WorkStep%type)
RETURN VARCHAR2
AS
Entries Number;
varStartTime varChar2(50);
varEndTime varChar2(50);
BEGIN
SELECT to_char(startdate, 'HH12:MI:SS')
INTO varStartTime
FROM tbl_History
WHERE prodid = vProdid
AND workstep = vWorkstep;
SELECT to_char(sysdate,'HH12:MI:SS') INTO varEndTime FROM dual;
IF to_number((varEndTime) - to_number(varStartTime)) < 1 THEN
RETURN 'Y';
ELSE
RETURN 'N';
END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN
RETURN 'N';
END;
/
Now I have these 2 variables, varStartTime and varEndTime...which contain times, i.e. 8:30 and 11:18.
How can I determine how much time, in hours, has elapsed between these two fields/..?
Thanks!