I am trying to run the dynamic query using a stored procedure in which I am sending the where condition case for example.
My sample stored procedure is shown here:
CREATE PROCEDURE `Storedproc`(IN getwhereconditon varchar(1000))
BEGIN
set @param=getwhereconditon ;
SET @S=concat('Select * from table where (1)',@param);
PREPARE stmt1 FROM @s;
EXECUTE stmt1;
END
Here my stored procedure's name is Storedproc in which I am passing the where condition details and when I call my stored procedure I am getting this error
Error Code: 1064. 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 '0tablecol=1' at line
andinStoreproc(and nqh.nqh_quarry_id=2)