Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

Procedimiento mysql

Estas en el tema de Procedimiento mysql en el foro de Mysql en Foros del Web. POR FAVOR ALGUIEN ME PUEDE DECIR POR QUE ME TIRA ESTE ERROR DE COMPILACIÓN?? GRACIAS. Código: use l2jdb; DROP procedure IF EXISTS `BorrarSkills`; DELIMITER $$ ...
  #1 (permalink)  
Antiguo 20/09/2015, 13:49
 
Fecha de Ingreso: agosto-2015
Mensajes: 20
Antigüedad: 8 años, 8 meses
Puntos: 0
Procedimiento mysql

POR FAVOR ALGUIEN ME PUEDE DECIR POR QUE ME TIRA ESTE ERROR DE COMPILACIÓN?? GRACIAS.
Código:
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

Etiquetas: procedimiento, select
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:59.