各位大神,mysql 提示错误“variable or condition declaration after cursor or handler declaration”,请问这是什么意思?该怎么解决? 源代码如下:
->create procedure delete_xs()
-> begin
-> declare xh char(6);
-> declare number_xs cursor for
-> select 学号 from xs_kc;
-> declare found boolean default true;
-> declare continue handler for not found
-> set found=false;
-> open number_xs;
-> fetch number_xs into xh;
-> while found do
-> delete from xs where 学号=xh;
-> fetch number_xs into xh;
-> end while;
-> close number_xs;
-> end$$MySQLCursorboolean源代码select
->create procedure delete_xs()
-> begin
-> declare xh char(6);
-> declare number_xs cursor for
-> select 学号 from xs_kc;
-> declare found boolean default true;
-> declare continue handler for not found
-> set found=false;
-> open number_xs;
-> fetch number_xs into xh;
-> while found do
-> delete from xs where 学号=xh;
-> fetch number_xs into xh;
-> end while;
-> close number_xs;
-> end$$MySQLCursorboolean源代码select
解决方案 »
- 求 mysql数据库,离职人员处理解决办法
- 关于MYSQL的transaction
- c#怎么读取mysql中 mediumtext类型的数据
- SQL(mysql)求助
- mysql-administator 启动后弹出警告框;couldn't find the setting 怎么处理
- 请问,不同服务器上的数据库如何操作
- mysql有类似与MS SQL SERVER 的ENTERPRISE MANAGER之类的图形界面下载吗
- 关于mysql数据库设计,高手来看看
- 为什么会出现这种错误!!!头疼
- 新人求助!一个mysql语句的写法
- Mysql 存储结构求助 200分赠送
- mysql关联查询上级用户
CREATE PROCEDURE delete_xs()
BEGIN
DECLARE xh CHAR(6);
DECLARE FOUND BOOLEAN DEFAULT TRUE;
DECLARE number_xs CURSOR FOR
SELECT 学号 FROM xs_kc;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET FOUND=FALSE;
OPEN number_xs;
FETCH number_xs INTO xh;
WHILE FOUND DO
DELETE FROM xs WHERE 学号=xh;
FETCH number_xs INTO xh;
END WHILE;
CLOSE number_xs;
END$$
DELIMITER ;
create procedure delete_xs()
-> begin
-> declare xh char(6);
-> declare number_xs cursor for
-> select 学号 from xs_kc;
-> declare found boolean default true;
-> declare continue handler for not found
-> set found=false;
-> open number_xs;
-> fetch number_xs into xh;
-> while found do
-> delete from xs where 学号=xh;
-> fetch number_xs into xh;
-> end while;
-> close number_xs;
-> end$$
-> delimiter;