0
需要幫助在這個簡單的任務。 這個sp應該提供一個結果集,並且會在MS-Access-Database報告中調用。準備stmt行thorws錯誤
表名是vvarying,但它以數字(lsid)結尾。使用Concatenatoin。 max_prepared_statement_count默認值16382
任何好主意?
THX 托馬斯
CREATE DEFINER=`root2`@`%` PROCEDURE `sp_Quickview02`(IN lsid int)
BEGIN
set @tbl = concat('shape_tokens_',lsid); -- tablename
set @sql= 'select base.Status, count(base.token) as Anzahl
from (select ?.completed, if(?.completed = ''N'',''offen'', ''abgeschlossen'') as Status,
?.token from ?) base group by base.status;'
PREPARE stmt FROM @sql; -- error is thrown here
EXECUTE stmt using @tbl;
DEALLOCATE PREPARE stmt;
END