Problem whith data and interval
Posted in 1999
Hello,
I've create a procedure for returning an Integer that is the
difference
of two date (datetime year to fraction type) in minutes .
The procedure is created but if i execute it i've an error of
conversion type.
I write you a little procedure with the error inside..
CREATE PROCEDURE MyTime(DATA1 DATETIME YEAR TO FRACTION,
DATA2 DATETIME YEAR TO FRACTION)
RETURNING INTEGER;DEFINE Giorni INTEGER;
DEFINE Ore INTEGER;
DEFINE Minuti INTEGER;
LET Giorni = DATE(DATA1) - DATE(DATA2);
LET Ore = EXTEND(DATA1, HOUR TO HOUR) - EXTEND(DATA2, HOUR TO
HOUR);
LET Minuti = EXTEND(DATA1, MINUTE TO MINUTE) - EXTEND(DATA2, MINUTE
TO
MINUTE));
LET Minuti = Minuti + 60 * Ore + 1440 * Giorni;
--OR LET Minuti=(DATA1-DATA2) UNITS MINUTE;
--THE RESULT IS THE SAME
RETURN Minuti;
END PROCEDURE;
When I execute this procedure I've this error:
Error 1260 it is not possible to convert between the specified type.
I think that the problem is that the
result of a DateDiff is an interval ...
Tanks Massimiliano
Sorry for the bad English!!!