DELIMITER |
CREATE TRIGGER trig_crm_customer_tongbu AFTER UPDATE ON ws_customer FOR EACH ROW
if NEW.old_uid is null then
insert into crm_customer_tongbu(user_id,sales,buys,address,tel,mobile,email,fax,contact_name)
values(new.old_uid,new.sale_Species,new.buy_Species ,new.corp_address ,new. contact_Tel ,new.contact_mobile,new.contact_Email ,new. fax_number,new.contact_Name);
end if;
|
DELIMITER ;编译时出错,但没有任何出错信息提示, 如果我把if..then ..end if 结构去掉,则可以通过,请问什么原因?
CREATE TRIGGER trig_crm_customer_tongbu AFTER UPDATE ON ws_customer FOR EACH ROW
if NEW.old_uid is null then
insert into crm_customer_tongbu(user_id,sales,buys,address,tel,mobile,email,fax,contact_name)
values(new.old_uid,new.sale_Species,new.buy_Species ,new.corp_address ,new. contact_Tel ,new.contact_mobile,new.contact_Email ,new. fax_number,new.contact_Name);
end if;
|
DELIMITER ;编译时出错,但没有任何出错信息提示, 如果我把if..then ..end if 结构去掉,则可以通过,请问什么原因?
CREATE TRIGGER trig_crm_customer_tongbu AFTER UPDATE ON ws_customer
FOR EACH ROW BEGIN
if NEW.old_uid is null then
insert into crm_customer_tongbu(user_id,sales,buys,address,tel,mobile,email,fax,contact_name)
values(new.old_uid,new.sale_Species,new.buy_Species ,new.corp_address ,new. contact_Tel ,new.contact_mobile,new.contact_Email ,new.fax_number,new.contact_Name);
end if;
END |
DELIMITER ;
-------------------------------------
多条语句就要在前后加
BEGIN
// code here ...
END