MySQL Forums
Forum List  »  Spanish

procedimientos almacenados
Posted by: gorka munduate
Date: June 21, 2010 03:02AM

Hola,

Genero una query dinémicamente y luego quiero trabajar con el resultado que me devuelve la query pero al llamar al procedimiento almacenado siempre me da este error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1"

Por ejemplo,

declare resultado int;
SET @s = CONCAT('SELECT inscripcion INTO',resultado,' FROM afedegi_inscripciones WHERE codigo_chip <> "" and id_usuario_web= ',usuario);
PREPARE stmt1 FROM @s;
EXECUTE stmt1;
IF resultado IS NOT NULL THEN
SELECT resultado ;
ELSE
SELECT 2;
END IF;

Alguien me puede ayudar? la sql está bien porque la he probado en phpmyadmin. Porque da ese error?

Muchas gracias

Options: ReplyQuote


Subject
Views
Written By
Posted
procedimientos almacenados
2822
June 21, 2010 03:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.