mysql触发器使用实例

DELIMITER $$

USE `db`$$

DROP TRIGGER `member_walletinit_trigger`$$

CREATE TRIGGER `member_walletinit_trigger` AFTER INSERT ON `member`
FOR EACH ROW BEGIN
SET @count = (SELECT COUNT(mem_no) FROM `wallet` WHERE mem_no = NEW.reg_no);
IF @count = 0 THEN
INSERT INTO wallet (mem_no)VALUE(NEW.reg_no);
END IF;
END;
$$ DELIMITER ;
上一篇:VS2010在C#头文件中添加文件注释的方法


下一篇:Mysql DBA 20天速成教程,DBA大纲