temp tables - MySQL: Syntax error, unexpected '@', expecting ':' -



temp tables - MySQL: Syntax error, unexpected '@', expecting ':' -

i want create temp table dynamically. passing column name parameter stored procedure.

example:

delimiter $$ create procedure sptemp(in nm varchar(50)) begin set @q = concat('create temporary table temptable  // error occuring here @q select distinct ', nm ,' col from table1'); prepare d from @q; execute d; deallocate prepare d; end$$ delimiter ;

error: syntax error, unexpected '@', expecting ':'

set @q = concat('create temporary table if not exists temptable (index(col)) engine=myisam (select distinct ', nm ,' col table1)');

as bonus - index of col column.

mysql temp-tables dynamicquery

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -