DROP TRIGGER IF EXISTS trigger_before_insert_purchase_debt_recover;
CREATE TRIGGER trigger_before_insert_purchase_debt_recover
BEFORE INSERT ON comp_purchase_debt_recover
FOR EACH ROW SET NEW.serialNo = (SELECT nextSerialNo FROM view_serial_comp_purchase_debt_recover WHERE companyID = NEW.companyID);