| 如何在mysql中创建和使用存储过程? |
| 来源:
发布时间:2008-03-11 发布人:
浏览:
人次
字体:
[大
中
小]
|
|
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;
| |
| |
|
|
|
|
| §最新评论:(评论内容只代表网友观点,与本站立场无关!) | |
|
|
|
|
| 注意:请勿在本站发布政治话题、色情及违反法律的内容。 |
IT知道网 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。 |