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();

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章