CREATE TRIGGER tr_bi_customer
  BEFORE INSERT ON CUSTOMER
  REFERENCING NEW AS inserted
  for each row BEGIN
DECLARE v_text varchar(254);
  DECLARE i_return_status INTEGER;
  SET v_text=inserted.CUSTOMER_NUM || '|' || inserted.ALPHA_KEY;
  SET v_text=v_text || '|' || inserted.NAME || '|' || inserted.ADDRESS1;
  SET v_text=v_text || '|' || inserted.PHONE;
  i_return_status = CALL sp_log_file_insdel_activity (inserted.loc, 68,
      inserted.id, NULL, NULL,
      v_text, 'A', inserted.last_modified_date, inserted.modified_by_employee_id, 1);
  IF i_return_status = -1 THEN
    SET inserted.modified_by_employee_id = NULL;
    SET inserted.last_modified_date = CURRENT TIMESTAMP;
  END IF;
  IF ((Select send_customer_domain from tams.store_profile) = 'Y') Then    
    Insert Into customer_change_queue (customer_id,loc,action,trigger_source)
			 Values (inserted.id,inserted.loc,'I','CUSTOMER');	
  END IF;
END;