MySQL存储过程的相关介绍:http://www.cnblogs.com/exmyth/p/3303470.html
获取、修改、删除数据(和普通的sql语句是一样的):
获取数据时,将 id 使用 into 赋值给在存储过程中定义的 newId。
declare newId int default 0; select id into newId from apple where name="smallApple";
批量插入:
BLOCK :BEGIN set insertSql=‘‘; set insertSql=concat(‘insert into tb_new(name,age,size) select name,age,size from tb_old); set @sqlinsert = insertSql; prepare stmtinsert from @sqlinsert; execute stmtinsert; END BLOCK;