MySQL Forums
Forum List  »  Spanish

Consultas sobre procedimientos almacenados..
Posted by: Juan Fernando Llanas Rdz
Date: October 04, 2006 10:11AM

Que tal colegas:

Fijense que estado trabajando con mysqly necesito ayuda para ejecutar una consulta desde un procedimiento almacenado pero esta consulta es almacenada en una Variable local por ejemplo:

CREATE procedure ...
BEGIN

DECLARE v_QUERY VARCHAR (1000);
SET v_QUERY ="SELECT * FROM EMPLOYES";
PREPARE stmt1 FROM v_QUERY ;
EXECUTE stmt1 ;

END $$


al ejecutar compilar o crear el store procedure me manda el siguiente mensaje de error:

Script line: 4 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 'v_QUERY;
EXECUTE stmt1 ;


en' at line 87


pero cuando creo la consulta de esta manera:


PREPARE stmt1 FROM "SELECT * FROM EMPLOYES";
EXECUTE stmt1 ;

END $$

no ocurre el erro alguientiene alguna respuesta?????
o alguna posibloe solucion a esto?

Options: ReplyQuote


Subject
Views
Written By
Posted
Consultas sobre procedimientos almacenados..
9065
October 04, 2006 10:11AM


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.