I have this Stored Procedure below, it works if my PostId is Integer field and i send postIdList as a comma separated string '1,2,3,4'... But if I change my PostId to GUID(char(36) it does not work for me. it gives me an syntax error saying
"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 '"2d9d3ebc-6c9f-467a-8181-8a38891756b)' at line 1"
CREATE DEFINER=`root`@`%` PROCEDURE `GetComments`(
IN postIdList TEXT
)
BEGIN
set @sql = CONCAT('select * from PostComment where PostId in (', postIdList, ') ');
PREPARE q FROM @sql;
execute q;
END$$
this is how i am calling it CAll GetComments( 'fff78ee0-396b-4300-952b-eee72d65261a,fff517dc-a7b7-441e-85bb-b5134828c0c9');
Any Ideas how to resolve this?