1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
DROP FUNCTION IF EXISTS PrepareCourbes;
CREATE FUNCTION PrepareCourbes (HrDeb DateTime, HrFin DateTime) RETURNS int
Begin
DECLARE Nbrec int;
DECLARE res int;
SELECT Nbrec() INTO res;
SELECT count(*) INTO Nbrec FROM test
WHERE (horodate between HrDeb and HrFin) AND (Right(HXDATE,1 ) = 0);
IF NbRec <= 0 THEN
Return -1;
END IF;
SELECT horodate, HxDate, V_00, V_01, V_02, V_03 FROM Test
WHERE (horodate between HrDeb and HrFin) AND (Right(HXDATE,1 ) = 0)
ORDER BY horodate Limit 144;
RETURN nbrec;
End; |