mysql数据库操作手册

 

1 存储过程的写法

以下是一个带有入参的存储过程模板,

#删除方案-存储过程
CREATE PROCEDURE procPersonAppointRecallPlanByPlanUuidDelete(in planUuid varchar(48)) 
BEGIN
update  PERSON_APPOINT_RECALL_DUTY set duty_status =2  WHERE duty_list_uuid in (select list_plan_uuid  from PERSON_APPOINT_RECALL_LIST where  list_plan_uuid=planUuid);

update  PERSON_APPOINT_RECALL_LIST set list_status =2 where list_plan_uuid=planUuid;

update  PERSON_APPOINT_RECALL_PLAN set plan_status =2 where plan_uuid =planUuid;
END

CALL procPersonAppointRecallPlanByPlanUuidDelete('93e858c62693435aa45d4c86498c3ebf'); 

注意:

1、存储过程有一套命名规则,需按规范命名;

2、了解到目前大部分互联网公司已不使用存储过程,只有公司的老项目才会用,因为使用存储过程,后期维护极其不方便,一个存储代码几百行,所以在项目中不推荐使用。

参考博客:

1、sql存储过程之命名标准

http://storage.it168.com/a2013/0102/1442/000001442521.shtml

2、MySQL存储过程写法总结

https://blog.csdn.net/anLA_/article/details/76794442?locationNum=7&fps=1

 

原文地址:https://www.cnblogs.com/syjp/p/11082736.html