Call to stored procedure , when procedure name in a variable in mysql

二次信任 提交于 2019-12-01 14:27:45

@Rahul , @Tim Biegeleisen Thank you for your responses. I used this statements to work done.

SET @q = 'sys_search';
SET @q2 = CONCAT('CALL ',@q,'(?,?,?)');
PREPARE stmt1 FROM @q2;
SET @a = 'All_Employees';
SET @b = 1;
SET @c = 1;
EXECUTE stmt1 USING @a, @b,@c; 

I don't think you can execute a stored procedure using dynamic query. Rather create the dynamic query with the SELECT involved in your procedure and execute that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!