Ayuda con error 1064.
Publicado por hadrien (24 intervenciones) el 14/04/2008 21:13:12
Hola,
estoy trabajando con MySQL 5.0. Tengo la tabla FILE con diferentes particiones FILE_PK (con k desde 0 hasta N ) y un procedimiento almacenado que inserta filas de valors en la partición correcta:
CREATE PROCEDURE insert_file (
IN idfile BIGINT UNSIGNED,
IN id2 VARCHAR(32),
IN name VARCHAR(128),
IN size BIGINT UNSIGNED,
IN checksum VARCHAR(32),
IN user SMALLINT UNSIGNED,
IN `group` TINYINT UNSIGNED,
IN permits TINYINT UNSIGNED,
IN dir BIGINT UNSIGNED
)
BEGIN
DECLARE n BIGINT DEFAULT 0;
IF idfile < 10000000 THEN
SET n = ( idfile DIV 5000 );
ELSE
SET n = 2000;
END IF;
SET @stmt = CONCAT('INSERT INTO file_p',n,
' VALUES(',idfile,',',id2,',',name,',',
size,',',checksum,',',user,',',`group`,',',permits,',',dir,')');
PREPARE stmt FROM @stmt;
EXECUTE stmt;
END;
Pero cuando llamo al procedimiento para insertar valores:
CALL insert_file(1,'123','/docs.txt',45,'gfretgfe',2,3,1,1);
Obtengo el siguiente error:
ERROR 1064 (42000) at line 24: You have an error in your SQL syntax; check the m
anual that corresponds to your MySQL server version for the right syntax to use
near '/docs.txt,45,gfretgfe45,2,3,1,1)' at line 1.
Sin embargo, no sé ver dónde está el problema realmente... ¿Alguien puede echarme una mano, por favor?
¡Gracias!
estoy trabajando con MySQL 5.0. Tengo la tabla FILE con diferentes particiones FILE_PK (con k desde 0 hasta N ) y un procedimiento almacenado que inserta filas de valors en la partición correcta:
CREATE PROCEDURE insert_file (
IN idfile BIGINT UNSIGNED,
IN id2 VARCHAR(32),
IN name VARCHAR(128),
IN size BIGINT UNSIGNED,
IN checksum VARCHAR(32),
IN user SMALLINT UNSIGNED,
IN `group` TINYINT UNSIGNED,
IN permits TINYINT UNSIGNED,
IN dir BIGINT UNSIGNED
)
BEGIN
DECLARE n BIGINT DEFAULT 0;
IF idfile < 10000000 THEN
SET n = ( idfile DIV 5000 );
ELSE
SET n = 2000;
END IF;
SET @stmt = CONCAT('INSERT INTO file_p',n,
' VALUES(',idfile,',',id2,',',name,',',
size,',',checksum,',',user,',',`group`,',',permits,',',dir,')');
PREPARE stmt FROM @stmt;
EXECUTE stmt;
END;
Pero cuando llamo al procedimiento para insertar valores:
CALL insert_file(1,'123','/docs.txt',45,'gfretgfe',2,3,1,1);
Obtengo el siguiente error:
ERROR 1064 (42000) at line 24: You have an error in your SQL syntax; check the m
anual that corresponds to your MySQL server version for the right syntax to use
near '/docs.txt,45,gfretgfe45,2,3,1,1)' at line 1.
Sin embargo, no sé ver dónde está el problema realmente... ¿Alguien puede echarme una mano, por favor?
¡Gracias!
Valora esta pregunta


0