I wrote the following dynamic query in my stored procedure,
FETCH cur1 INTO a1, ldt1, b1;
WHILE DONE = 0 DO
SET @s=CONCAT('UPDATE ',fname , ' SET connectedDateTime = ldt1,opid = b1
WHERE hq_conferee_seqno=a1 AND (LoggedDateTime <=ldt1 AND connectedDateTime IS NULL)');
FETCH cur1 INTO a1, ldt1, b1;
PREPARE stmt FROM @s;
EXECUTE stmt;
END WHILE;
CLOSE cur1;
When I compile the stored I am not getting any error. But When I run this code I got an error like 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
What will be the problem. Please help me. Thanks in advance.