mysql multiple triggers-在一个触发器之后结束代码

ljsrvy3e  于 2021-06-18  发布在  Mysql
关注(0)|答案(0)|浏览(186)

我有一个存储客户数据的应用程序。
我必须确保在一个表中插入customer,比如在database中插入t1,比如d1,应该在database d2的表t1中插入相同的内容。
客户数据与三个不同的表链接:公司、客户和地址。
因此,我编写了三个触发器,一个用于company表,一个用于customer,最后一个用于address表。当我运行代码时,第一个触发器工作。然后运行的代码停止了,并在laravel中显示了一个空白页。
我以不同的方式进行了检查,发现在数据库中的一个触发器之后,代码停止了。
我怎样才能解决这个问题?
我的触发代码如下:

DELIMITER &&

create trigger after_insert_ecatalog_company after insert on `ecatalog`.company for each row begin insert into `eRetailer`.company(id, code, name, is_active, created_at, updated_at) values (NEW.id, NEW.code, NEW.name, NEW.is_active, NEW.created_at, NEW.updated_at); END&&

DELIMITER ;

DELIMITER &&

create trigger after_insert_ecatalog_customer after insert on `ecatalog`.customer for each row begin insert into `eRetailer`.customer(id, store_id, company_id, customer_type_id, email, username, phone, srepemail, srepecode, password, firstname, lastname, salesrep_name, salesrep_email, is_active, is_password_changed, remember_token, created_at, updated_at, role) values (NEW.id, NEW.store_id, NEW.company_id, NEW.customer_type_id, NEW.email, NEW.username, NEW.phone, NEW.srepemail, NEW.srepecode, NEW.password, NEW.firstname, NEW.lastname, NEW.salesrep_name, NEW.salesrep_email, NEW.is_active, NEW.is_password_changed, NEW.remember_token, NEW.created_at, NEW.updated_at, NEW.role); END&&

DELIMITER ;

DELIMITER &&

create trigger after_insert_ecatalog_address after insert on `ecatalog`.address for each row begin insert into `eRetailer`.address(id, customer_id, address_type, name, addr1, addr2, city, state, zip, phone, email, code, shipvia, created_at, updated_at, billtocompany, shiptocompany, shiptocountry) values (NEW.id, NEW.customer_id, NEW.address_type, NEW.name, NEW.addr1, NEW.addr2, NEW.city, NEW.state, NEW.zip, NEW.phone, NEW.email, NEW.code, NEW.shipvia, NEW.created_at, NEW.updated_at, NEW.billtocompany, NEW.shiptocompany, NEW.shiptocountry); END&&

DELIMITER ;

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题