MySql 存储过程及调用方法

存储过程实例:

DELIMITER $$
drop procedure if exists ff $$
CREATE

/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE ff()
/*LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }
| COMMENT 'string'*/
BEGIN
declare i integer;
declare am integer;
declare idx integer;
set idx=512;
set am=100;
set i=0;
while i<303 do
begin

if idx != 612
then
update mgrcapitaldf set balance=balance+am*i where id=idx;
set i = i +1;
end if;

set idx = idx+1;

end;
end while;

END$$

DELIMITER ;

 

-- 调用方法:

call ff();

posted @ 2016-10-11 17:20  spplus  阅读(525)  评论(0编辑  收藏  举报