0
我有一个存储过程来更新两个表中的某些值。但是,要更新的参数列表或一组值将增加到10个参数,未来可能会增长更多。这怎么处理?如何避免存储过程的长参数列表?
CREATE DEFINER=`root`@`localhost` PROCEDURE `update_base_plan`(userId int,newPlanId int,nextPlanId int,maxCreditPulseAllocated int)
begin
if userId is not null and newPlanId is not null and nextPlanId is not null
and maxCreditPulseAllocated is not null
then
update planallocation as pa
left join subscriptioninfo as si
on pa.SubscriptionId = si.SubscriptionId
left join plans as pl
on pa.CurrentPlanId = pl.PlanId
set pa.CurrentPlanId = newPlanId, pa.NextPlanId = nextPlanId,
pa.MaxCreditPulseAllocated = maxCreditPulseAllocated
where pl.Plan_Type = 'base' and
si.UserId = userId;
end if;
end$$
DELIMITER ;
MySQL是否支持JSON? –
在较新的版本是的。不知道哪个版本介绍它。快速浏览页面建议只有版本5.7具有json功能...悲伤; o / – Jakumi