MySQL - ERROR 1024 EN MYSQL AL EJECUTRA UNA FUNCION

 
Vista:

ERROR 1024 EN MYSQL AL EJECUTRA UNA FUNCION

Publicado por elizabeth (3 intervenciones) el 29/03/2013 01:03:09
Holas.. eh ejecutado una consulta en mysql remotamente y me bota el error 1024 pero al ejecutar localmente me corre normalmente le envio el codigo original.. VERSION DE mysql 5.0.95
este es el error:
error 1064(42000): You have an error in your SQL syntaxis; check the manual that corresponds to your Mysql server version for the right syntax to use near ''I' THEN SET xinNewValue=1;
WHEN 'V' THEN SET xint NewValue = 5;
w' at line 18

aqui le dije el codigo:

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
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `RomanToInteger`(
  `xstrRoman` varchar(4)
) RETURNS int(11)
BEGIN
   DECLARE xi INT;
   DECLARE xstrCharacther CHAR(30);
   DECLARE xintResult INT;
   DECLARE xintNewValue INT;
   DECLARE xintOldValue INT;
 
   SET xstrRoman = UPPER(xstrRoman);
   SET xintOldValue = 1000;
   SET xintNewValue = 0;
   SET xintResult = 0;
   SET xi=1;
 
   WHILE (xi<= length(xstrRoman)) DO
     SET xstrCharacther = SUBSTRING(xstrRoman, xi, 1);
 
     CASE xstrCharacther
      WHEN 'I' THEN SET xintNewValue = 1;
      WHEN 'V' THEN SET xintNewValue = 5;
      WHEN 'X' THEN SET xintNewValue = 10;
      WHEN 'L' THEN SET xintNewValue = 50;
      WHEN 'C' THEN SET xintNewValue = 100;
      WHEN 'D' THEN SET xintNewValue = 500;
      WHEN 'M' THEN SET xintNewValue = 1000;
     END CASE;
 
    IF xintNewValue > xintOldValue THEN
      SET xintResult = xintResult + xintNewValue - 2 * xintOldValue;
    ELSE
      SET xintResult = xintResult + xintNewValue;
    END IF;
    SET xintOldValue = xintNewValue;
    SET xi=xi+1;
 
 END WHILE;
    Return xintResult;
END
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 796
Oro
Ha mantenido su posición en MySQL (en relación al último mes)
Gráfica de MySQL

ERROR 1024 EN MYSQL AL EJECUTRA UNA FUNCION

Publicado por xve (1151 intervenciones) el 29/03/2013 09:11:59
Hola Elizabeth, aqui tienes algun problema, ya que en tu código no existe la variable: xinNewValue que es el error que te esta dando... Revisa que en el mysql remoto tengas el mismo procedimiento.

Coméntanos, ok?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ERROR 1024 EN MYSQL AL EJECUTRA UNA FUNCION

Publicado por elizabeth (3 intervenciones) el 01/04/2013 16:47:22
Holas gracias por tu respuesta,, me habia confundido en el error:
error 1064(42000): You have an error in your SQL syntaxis; check the manual that corresponds to your Mysql server version for the right syntax to use near ''I' THEN SET xintNewValue=1;
WHEN 'V' THEN SET xintNewValue = 5; ...es con "t" me falto poner esa letra..gracias por sus respuestas..
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

ERROR 1024 EN MYSQL AL EJECUTRA UNA FUNCION

Publicado por elizabeth (3 intervenciones) el 01/04/2013 22:52:56
escribe mal error..estare pendiente de sus repuestas para descubrir este error--gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar