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:
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


0