Bonjour a tous

J'ai cette erreur en créant cette procédure :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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;
[Err] 1415 - Not allowed to return a result set from a function

J'ai tenté pas mal de solutions sans résultat..
alors merci a celui ou ceux qui pourraient m'aider