navicat 8.0 mysql中如何调用存储过程
2个回答
展开全部
CREATE DEFINER=`root`@`localhost` PROCEDURE `curdemo`()
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE userid,repid INT;
DECLARE cur1 CURSOR FOR select u.userid,u.repid from user u,personalwebsite p where
p.url u.repid and p.distributorid = u.userid
and p.url = u.userid;
DECLARE CONTINUE HANDLER FOR SQLSTATE \'02000\' SET done = 1;
OPEN cur1;
REPEAT
FETCH cur1 INTO userid,repid;
IF NOT done THEN
update personalwebsite set url = repid where distributorid = userid;
END IF;
UNTIL done END REPEAT;
CLOSE cur1;
END;
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE userid,repid INT;
DECLARE cur1 CURSOR FOR select u.userid,u.repid from user u,personalwebsite p where
p.url u.repid and p.distributorid = u.userid
and p.url = u.userid;
DECLARE CONTINUE HANDLER FOR SQLSTATE \'02000\' SET done = 1;
OPEN cur1;
REPEAT
FETCH cur1 INTO userid,repid;
IF NOT done THEN
update personalwebsite set url = repid where distributorid = userid;
END IF;
UNTIL done END REPEAT;
CLOSE cur1;
END;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询