Tuesday, 12 May 2015

Dynamic Query in mysql

Dynamic Query

delimiter $
CREATE PROCEDURE execute_immediate(in_sql VARCHAR(4000))
BEGIN
SET @tmp_sql=in_sql;
PREPARE s1 FROM @tmp_sql;
EXECUTE s1;
DEALLOCATE PREPARE s1;
END$

call execute_immediate('select * from actor;');

No comments:

Post a Comment