drop trigger if exists sorder_bd_before_delete; DELIMITER // create trigger sorder_bd_before_delete before delete on dbr_sorder_bd for each row begin delete from dbr_sales_bd where sorder_bd_id = old.id; call credit_bd_act('sordbd', old.id, -1); END// DELIMITER ;