두 테이블의 특정 값을 업데이트하는 저장 프로 시저가 있습니다. 그러나 논쟁의 목록이나 업데이트 할 가치의 집합은 10 가지 논쟁으로 발전했으며 앞으로 더 커질 수 있습니다. 어떻게 처리 할 수 있습니까? A (저장) 절차는 N 매개 변수를 필요로하는 경우저장 프로 시저에 대한 긴 인수 목록을 피하는 방법은 무엇입니까?
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