标签:style blog color os io 数据 for 问题
1、权限问题
alter routine 编辑或删除存储过程
create routine 建立存储过程
execute 创建存储过程
2、存储过程相关的一些命令
show procedure status\G 查看数据库中有哪些存储过程 show procedure status where db = ‘db_name‘\G 查看指定数据库(db_name)中有哪些存储过程 select name from mysql.proc where db = ‘db_name‘; 查看指定数据库(db_name)中有哪些存储过程 select routine_name from information_schema.routines where routine_schema = ‘db_name‘; 查看指定数据库(db_name)中有哪些存储过程 show create procedure dbname.sp_delete_bakhistory_new \G 查看存储过程的详细内容
3、MySQL 存储过程删除大表
delimiter // CREATE PROCEDURE `sp_delete_bigtable_60`( ) BEGIN declare v_id int; declare stopflag int; declare v_num int; declare cursor_id cursor for select id from bigtable where gmt_created<now()-interval 60 day; declare continue handler for not found set stopflag=1; open cursor_id; repeat fetch cursor_id into v_id; begin delete from bigtable where id =v_id; end; set v_num=v_num+1; if mod(v_num,100)=0 then commit; end if; until stopflag = 1 end repeat; close cursor_id; END; // delimiter ;
标签:style blog color os io 数据 for 问题
原文地址:http://www.cnblogs.com/jthb/p/3894239.html