msyql 触发器语法问题 ,下面语法报错了,问题出在if语句上
create trigger i_daily
before insert on  Daily_record
for each row begin
 select 
cooperation_mode_id,income_ratio into @cooperation_mode_id,@income_ratio
from 
Promotion_package where promotion_package_id=new.promotion_package_id;
end

if @cooperation_mode_id = 1 then
    set new.income=new.pay_all*@income_ratio;
elseif @cooperation_mode_id = 2 then
    set new.income=new.added_number*@income_ratio;
end if;
end

想问问到大佬们怎么改这个语法

1个回答

create trigger i_daily on Daily_record for insert
as
begin
select cooperation_mode_id,income_ratio into @cooperation_mode_id,@income_ratio from Promotion_package where promotion_package_id=new.promotion_package_id;
end

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问