mysql表字段的默认值为函数的返回值 用mysql触发器实现

create trigger idtrigger
before insert on record_test_str
for each ROW
BEGIN
	SET new.ID=getIdFunc();
END


http://stackoverflow.com/questions/270309/can-i-use-a-function-for-a-default-value-in-mysql

由于mysql建表时,默认值不能为一个函数,所以需要采取触发器去实现。
但是mysql触发器里再对触发器所监听的表进行insert和update是不行的

猜你喜欢

转载自2018scala.iteye.com/blog/2304079