我在mysql上的这个存储过程创建成功,但怎么不能用啊?
存储过程创建如下:CREATEPROCEDUREclear_50message(tablenamechar(10))BEGINDECLAREid,bINT;DECLARE...
存储过程创建如下:
CREATE PROCEDURE clear_50message(tablename char(10))
BEGIN
DECLARE id,b INT;
DECLARE i INT DEFAULT -1;
DECLARE cur_2 CURSOR FOR SELECT authorid FROM tablename group by authorid;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET b = 1;
OPEN cur_2;
REPEAT
FETCH cur_2 INTO id;
delete posts_99 as ps from tablename as ps,
(select message from tablename where authorid=id order by LENGTH(message)
desc limit 50,10000)
as ap
where ps.message = ap.message and authorid=id;
SET i = i + 1;
UNTIL b = 1
END REPEAT;
CLOSE cur_2;
select concat(i," authors had be deal") as dealresult;
END;
我想传入参数为表明,但是传入表名posts_80后执行出错,
[SQL] call clear_50message (posts_80)
[Err] 1054 - Unknown column 'posts_80' in 'field list'这是什么意思啊?
如果这样写call clear_50message('posts_80');他又出现表不存在
[Err] 1146 - Table 'ccnu_boya.tablename' doesn't exist
可是明明存在啊 展开
CREATE PROCEDURE clear_50message(tablename char(10))
BEGIN
DECLARE id,b INT;
DECLARE i INT DEFAULT -1;
DECLARE cur_2 CURSOR FOR SELECT authorid FROM tablename group by authorid;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET b = 1;
OPEN cur_2;
REPEAT
FETCH cur_2 INTO id;
delete posts_99 as ps from tablename as ps,
(select message from tablename where authorid=id order by LENGTH(message)
desc limit 50,10000)
as ap
where ps.message = ap.message and authorid=id;
SET i = i + 1;
UNTIL b = 1
END REPEAT;
CLOSE cur_2;
select concat(i," authors had be deal") as dealresult;
END;
我想传入参数为表明,但是传入表名posts_80后执行出错,
[SQL] call clear_50message (posts_80)
[Err] 1054 - Unknown column 'posts_80' in 'field list'这是什么意思啊?
如果这样写call clear_50message('posts_80');他又出现表不存在
[Err] 1146 - Table 'ccnu_boya.tablename' doesn't exist
可是明明存在啊 展开
壹寰(深圳)科技文化有限公司
2021-03-27 广告
2021-03-27 广告
不同公司提供的方案也不一样。以上回答如果还觉得不够详细,可以来咨询下壹寰(深圳)科技文化有限公司。91数据恢复是壹寰(深圳)科技文化有限公司旗下专业数据恢复品牌,91数据恢复专注于勒索病毒数据恢复、勒索病毒数据修复、数据库修复、数据库解密恢...
点击进入详情页
本回答由壹寰(深圳)科技文化有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询