delimiter $$
DROP TRIGGER IF EXISTS tri_nis_billhead_before_insert $$
CREATE TRIGGER tri_nis_billhead_before_insert 
BEFORE INSERT ON nis_billhead
FOR EACH ROW
BEGIN
        declare counts int;
        select count(1) into counts from nis_billhead where out_sys_bill_no=new.out_sys_bill_no;
        if counts >0 then 
                SIGNAL SQLSTATE 'HY000' SET MESSAGE_TEXT='外部系统单号重复';
        end if;
                
END $$
delimiter ;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2022-03-08
  • 2021-09-24
相关资源
相似解决方案