Bonjour,
J'utilise un cursor dans une boucle d'une procédure stockée. Quand la boucle ne fait aucun traitement mon curseur marche, mais quand je réalise les traitements, IQ me dit que le cursor n'est pas ouvert.
Ceci fonctionne
Ceci 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
16
17
18
19
20
21
22
23 DECLARE CURSEUR CURSOR FOR SELECT TABLE_NAME FROM IOC_PURGE_TABLES OPEN CURSEUR FETCH CURSEUR INTO @NomTable while (@compteTable>0) begin select @compteTable = @compteTable - 1 FETCH CURSEUR INTO @NomTable message @NomTable to client message @compteTable to client END CLOSE CURSEUR Deallocate Cursor CURSEUR
Si vous avez une idée je suis preneur.
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
18
19
20
21
22
23
24
25
26
27
28
29 DECLARE CURSEUR CURSOR FOR SELECT TABLE_NAME FROM IOC_PURGE_TABLES OPEN CURSEUR FETCH CURSEUR INTO @NomTable while (@compteTable>0) begin SELECT @SQL = 'truncate table '+@NomTable execute (@SQL) select @compteTable = @compteTable - 1 FETCH CURSEUR INTO @NomTable message @NomTable to client message @compteTable to client END CLOSE CURSEUR Deallocate Cursor CURSEUR
Merci
Partager