Bonjour,

Je débute en curseurs SQL et j'ai écrit le code suivant pour mySQL qui ne fonctionne pas:

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
 
// selection par heure sur la journée courante;
 
DECLARE DateCursor CURSOR FOR
  SELECT lastmodificationdate FROM result
OPEN DateCursor
FETCH NEXT FROM DateCursor
 
WHILE @@FETCH_STATUS = 0
BEGIN
  select hour(lastmodificationtime), count(*) from result group by hour(lastmodificationtime)
END
 
CLOSE DateCursor
DEALLOCATE DateCursor
et je reçois cette erreur:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE DateCursor CURSOR FOR
SELECT lastmodificationdate FROM result
OPEN D' at line 1

Quelqu'un pourrait-il m'aider ?
Aussi, je ne sais pas trop ou mettre des délimiteurs (caractère ; dans mon cas)