[ Foro de SQL (y MySQL) ]

Ayuda Procedimiento MYSQL

20-Sep-2015 22:01
Invitado (matitlive)
1 Respuestas

POR FAVOR ALGUIEN ME PUEDE DECIR POR QUE ME TIRA ESTE ERROR DE COMPILACIÓN?? GRACIAS.

use l2jdb;
DROP procedure IF EXISTS `BorrarSkills`;

DELIMITER $$
use l2jdb$$

CREATE PROCEDURE BorrarSkills (chname varchar(35))
BEGIN
Declare idchar decimal(11,0);
Declare haveskills int(11);
Declare i int(1);
Declare skill_id1 int(3);
Declare skill_id2 int(3);
Declare skill_id3 int(3);
Declare level1 int(2);
Declare level2 int(2);
Declare level3 int(2);
#SET idlight1=(select skill_id from character_skill where skill_id=236 and obj_id=idchar);
SET idchar = (select obj_id from  characters where char_name = chname);
SET skill_id1=(select skill_id from character_skills where char_obj_id=idchar and skill_id=236);
SET skill_id2=(select skill_id from character_skills where char_obj_id=idchar and skill_id=252);
SET skill_id3=(select skill_id from character_skills where char_obj_id=idchar and skill_id=258);
#231, 232, 253,259 HEAVY ARMOR MASTERY
# LIGHT ARMOR MASTERY 236, 258, 252
#234,235,251 ROBE MASTERY
if idchar > 1  then
SET i=0;
if skill_id1=236 then
 set i = i+1;
 set level1=(select skill_level from character_skills where skill_id=236 and char_obj_id=idchar);
END if
 if skill_id2=252 then
 set  i = i+1;
 set level2=(select skill_level from character_skills where skill_id=252 and char_obj_id=idchar);
END if
 if skill_id3=258 then
 set i=i+1;
 set level3=(select skill_level from character_skills where skill_id=258 and char_obj_id=idchar);
END if
if i<1 then
 if level1>level2 then
  delete from character_skills where skill_id=236 and char_obj_id=idchar;
 else if level2>level1 then
  delete from character_skills where skill_id=252 and char_obj_id=idchar;
 else if level1>level3 then
  delete from character_skills where skill_id=236 and char_obj_id=idchar;
 else if level3>level1 then
  delete from character_skills where skill_id=258 and char_obj_id=idchar;
 else if level3>level2 then
  delete from character_skills where skill_id=258 and char_obj_id=idchar;
 else if level2>level3 then
  delete from character_skills where skill_id=252 and char_obj_id=idchar;
END IF
END IF
END$$

DELIMITER ;

*******ERROR*******

[Err] 1064 - Erreur de syntaxe près de 'if skill_id2=252 then
 set  i = i+1;
 set level2=(select skill_level from ch' à la ligne 26


23-Sep-2015 23:55
Nacho Cabanes (+32)

¿No puede ser simplemente que te falte un punto y coma para cerrar los END IF?  Como hay más órdenes detrás, debería tenerlo.






(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)