set @ins := concat('replace into ',@tbl,'_archive select * from ',@tbl,' where ',@col,' < ',@plw); prepare instmnt from @ins; execute instmnt;