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