Salut tout le monde....

J'ai créer une procédure pl/sql. Celle-ci est compilée sans aucune erreurs !!!
Par contre lorsque je lance l'exécution de celle-ci, une erreur au niveau de mon premier curseur apparait... Quelqu'un a déjà rencontré ce problème et aurait une idée d'où cela peut venir???


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
30
31
32
33
CREATE OR REPLACE PROCEDURE frequency_product (nbYear NUMBER) IS
	CURSOR C_Staging IS
		SELECT  HostPartID, COUNT (HostPartID) AS I
		FROM Staging
		WHERE MONTHS_BETWEEN(sysdate, SalesOrderMatAvailDt) <= nbYear*12
		GROUP BY HostPartID
		ORDER BY I DESC;
	demToT NUMBER;
	threshold NUMBER := 0;
	i NUMBER := 0;
	enreg C_Staging%ROWTYPE;
BEGIN
	SELECT COUNT (HostPartID) into demToT
	FROM Staging
	WHERE MONTHS_BETWEEN(sysdate, SalesOrderMatAvailDt) <= nbYear*12;
	threshold := 80/100 * demTot;
	LOOP
		FETCH C_Staging INTO enreg;
		EXIT WHEN C_Staging%NOTFOUND;
		i := i + enreg.I;
			UPDATE Product 
				SET Frequency='High'
				WHERE HostPartID=enreg.HostPartID;
		EXIT WHEN i >= threshold;
	END LOOP;
	LOOP
		FETCH C_Staging INTO enreg;
		EXIT WHEN C_Staging%NOTFOUND;
			UPDATE Product 
				SET Frequency='Low'
				WHERE HostPartID=enreg.HostPartID;
	END LOOP;	
END;
Erreur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
*
ERREUR à la ligne 1 :
ORA-01001: curseur non valide
ORA-06512: à "HISTOADM.FREQUENCY_PRODUCT", ligne 18
ORA-06512: à ligne 1
En vous remerciant et vous souhaitant une agréable journée !!!