Bonjour!!
J'ai à nouveau un petit souci. Ma procédure est syntaxiquement parlant juste.
Le problème est quelle me retourne une erreur qui est:
+--------------+
| var_date_dep |
+--------------+
| 2009-04-13 |
+--------------+
1 row in set (10.52 sec)

+--------------+
| var_date_dep |
+--------------+
| NULL |
+--------------+
1 row in set (10.52 sec)

+--------------------------------------------------------------------------+
| var_date_fin= ADDDATE(curdate(), (- DATE_FORMAT (curdate(), '%w') + 14)) |
+--------------------------------------------------------------------------+
| NULL |
+--------------------------------------------------------------------------+
1 row in set (10.53 sec)

ERROR 1329 (02000): No data - zero rows fetched, selected, or processed
mysql>
Voici la procédure retournant ce résultat. (je précise c'est la première fois que je fait une procédure stockée sous MySQL).

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 
 
 
 
DELIMITER |
 
use maintenance1 |
SET SQL_MODE = ANSI |
DROP PROCEDURE IF EXISTS action_ensemble|
 
CREATE DEFINER = 'maintenance'@'localhost' PROCEDURE action_ensemble()
BEGIN
	DECLARE var_machine char( 5);
	DECLARE var_tache char( 100);
	DECLARE var_thisdate date;
	DECLARE var_date_dep date;
	DECLARE var_date_fin date;
	DECLARE var_temp char( 10);
	DECLARE var_secteur char( 25);
	DECLARE var_period int;
	DECLARE fetch_status INTEGER default 0;
	DECLARE var_sql char( 255);
 
	DECLARE C_tache_machine CURSOR FOR
		SELECT nom_machine, nom_tache
		FROM t_tache_machine
		WHERE ( t_tache_machine.periode_tache <> 9999 
		AND t_tache_machine.periode_tache <> 999)
		ORDER BY nom_machine;
 
 
	DECLARE C_date CURSOR FOR
		SELECT Date_prev FROM T_data WHERE nom_machine =RTRIM(var_machine) 
		AND nom_tache= RTRIM(var_tache)  AND date_prev=(select max(date_prev) 
		FROM T_data WHERE nom_machine =  + RTRIM(var_machine) 
		AND nom_tache=  RTRIM(var_tache) ) limit 1;
 
	DECLARE C_donne CURSOR FOR
		SELECT nom_machine, secteur_machine, nom_tache, periode_tache
		FROM T_tache_machine
		WHERE nom_machine= var_machine AND nom_tache= var_tache 
		AND(t_tache_machine.periode_tache<> 9999 
		AND t_tache_machine.periode_tache<> 999) limit 1;
 
 
 
 
  OPEN C_tache_machine;
  FETCH	NEXT FROM C_tache_machine INTO var_machine, var_tache;
  WHILE FETCH_STATUS= 0 DO
 
  OPEN C_date;
  OPEN C_donne;
 
  FETCH FROM C_date INTO var_thisdate;
  FETCH FROM C_donne INTO var_machine, var_secteur, var_tache, var_period;
  SELECT var_thisdate;
 
  IF DATEDIFF(var_thisdate, Now())> 31 OR FETCH_STATUS<> 0 
	THEN
		SELECT ADDDATE(curdate(), - DATE_FORMAT(curdate(), '%w') + 8) as var_date_dep;
		SELECT var_date_dep;
	ELSE
		SELECT var_date_dep= COALESCE(var_thisdate, (adddate(curdate(), (-date_format(curdate(), '%w')+8))));
 
  END IF;
 
SELECT var_date_fin= ADDDATE(curdate(), (- DATE_FORMAT (curdate(), '%w') + 14));
	WHILE (select var_date_dep)< var_date_fin DO
		IF (SELECT DATE_FORMAT(var_date_dep, '%w')) < 6 
			THEN
				INSERT T_data (nom_machine, secteur_machine, nom_tache, date_prev, periodicite_tache) 
				VALUES (var_machine, var_secteur, var_tache, var_date_dep, var_period);
		END IF;
		SELECT var_date_dep= ADDTIME (var_date_dep, var_period * 4);
	END WHILE;
	CLOSE C_donne;
	CLOSE C_date;
	FETCH NEXT FROM C_tache_machine INTO var_machine, var_tache;
	END WHILE;
	CLOSE C_tache_machine;
END|
 
DELIMITER ;
Je suis bien embété car cela fait maintenant 10 jours que je cherche à la débugger sans résultat.

Voici les informations pour éventuellement faire un jeu d'essaie:
Création des tables:
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
34
35
36
37
38
39
40
41
42
43
 
CREATE TABLE `t_data` (
  `num_data`           int(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `nom_machine`        char(25) NOT NULL,
  `secteur_machine`    char(25) NOT NULL,
  `nom_tache`          char(100) NOT NULL,
  `lien_tache`         char(150),
  `date_prev`          date NOT NULL,
  `date_eff`           date,
  `periodicite_tache`  int(4) NOT NULL,
  `code_user`          int(4)
) ENGINE = MyISAM;
 
CREATE TABLE `t_machine` (
  `num_machine`      int(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `nom_machine`      char(5) NOT NULL,
  `secteur_machine`  char(5) NOT NULL,
  `cc_machine`       char(20) NOT NULL
) ENGINE = MyISAM;
 
CREATE TABLE `t_tache` (
  `num_tache`   int(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `nom_tache`   char(100) NOT NULL,
  `lien_tache`  char(150)
) ENGINE = MyISAM;
 
CREATE TABLE `t_tache_machine` (
  `num_tache_machine`  int(4) AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `nom_machine`        char(5) NOT NULL,
  `secteur_machine`    char(20) NOT NULL,
  `cc_machine`         char(5) NOT NULL,
  `nom_tache`          char(100) NOT NULL,
  `lien_tache`         char(150),
  `periode_tache`      int(4) NOT NULL,
  `debut_periode`      date
) ENGINE = MyISAM;
 
CREATE TABLE `t_user` (
  `num_user`     int(6) AUTO_INCREMENT NOT NULL PRIMARY KEY,
  `nom_user`     char(30) NOT NULL,
  `prenom_user`  char(30) NOT NULL,
  `code_user`    int(4) NOT NULL
) ENGINE = MyISAM;
Données:
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
34
 
INSERT INTO `T_data` VALUES ('262','1','D2','Changer le filtre',NULL,STR_TO_DATE('04/04/2005 00:00:00','%d/%m/%Y %T'),NULL,'6','272');
INSERT INTO `T_data` VALUES ('263','1','D2','Changer le filtre',NULL,STR_TO_DATE('05/04/2005 00:00:00','%d/%m/%Y %T'),NULL,'6','272');
INSERT INTO `T_data` VALUES ('264','1','D2','Changer le filtre',NULL,STR_TO_DATE('06/04/2005 00:00:00','%d/%m/%Y %T'),NULL,'6','448');
INSERT INTO `T_data` VALUES ('265','1','D2','Changer le filtre',NULL,STR_TO_DATE('07/04/2005 00:00:00','%d/%m/%Y %T'),NULL,'6','210');
INSERT INTO `T_data` VALUES ('266','1','D2','Changer le filtre',NULL,STR_TO_DATE('08/04/2005 00:00:00','%d/%m/%Y %T'),NULL,'6','272');
 
 
INSERT INTO `T_machine` VALUES ('29','1','D2','51D2');
INSERT INTO `T_machine` VALUES ('4','1','D2','52D2M');
INSERT INTO `T_machine` VALUES ('38','10','D2','51D2');
INSERT INTO `T_machine` VALUES ('128','100','D2','51D2');
INSERT INTO `T_machine` VALUES ('129','101','D2','51D2');
 
 
INSERT INTO `T_tache` VALUES ('15','CHANGEMENT FILTRES 1, 2, 3','\\memetecnot01\eteaux\atelier\fiche\53LA\FI1442.htm');
INSERT INTO `T_tache` VALUES ('6','Changer le filtre','\\memetecnot01\eteaux\atelier\fiche\FI 144 .htm #test');
INSERT INTO `T_tache` VALUES ('75','CN BS12 nettoyage pince','\\memetecnot01\eteaux\Atelier\fiche\51CN\tsugami bs12\FI1449.htm');
INSERT INTO `T_tache` VALUES ('73','CN BS12 vidange bac machine','\\memetecnot01\eteaux\Atelier\fiche\51CN\tsugami bs12\FI1443.htm');
INSERT INTO `T_tache` VALUES ('74','CN BS12 vidange embarreur','\\memetecnot01\eteaux\Atelier\fiche\51CN\tsugami bs12\FI1444.htm');
 
 
INSERT INTO `T_tache_machine` VALUES ('73','700','TO','51TO','NETTOYAGE MACHINE','','720',NULL);
INSERT INTO `T_tache_machine` VALUES ('64','700','TO','51TO','to m7 debut de poste (doc)','\\memetecnot01\eteaux\Atelier\fiche\52TO\M7\FI1445.htm','6',NULL);
INSERT INTO `T_tache_machine` VALUES ('71','700','TO','51TO','TO M7 MOP','\\memetecnot01\eteaux\Atelier\fiche\52TO\M7\FI1441.htm','9999',NULL);
INSERT INTO `T_tache_machine` VALUES ('72','700','TO','51TO','TO M7 PS','\\memetecnot01\eteaux\Atelier\fiche\52TO\M7\FI1442.htm','999',NULL);
INSERT INTO `T_tache_machine` VALUES ('79','701','TO','51TO','NETTOYAGE MACHINE','','720',NULL);
 
 
INSERT INTO `T_user` VALUES ('113','PIERRE','ANDRE','105');
INSERT INTO `T_user` VALUES ('114','DUPONT','JACQUES','106');
INSERT INTO `T_user` VALUES ('148','ANTOINE','MARC','149');
INSERT INTO `T_user` VALUES ('164','MARTIN','ANGELIQUE','168');
INSERT INTO `T_user` VALUES ('109','RINTINTIN','NABIL','100');

Autre chose, connaitriez-vous un logiciel pour analyser ligne par ligne une procédure stockée (débogger MySQL)?

Un GRAND MERCI!! A toute personne pouvant m'apporter même une toute petite info pour m'aider à avancer.