mysql上的触发器有问题,代码如下:
delimiter // create trigger myimage_trigger before insert on products for each row begin if (NEW.image is null ) then set NEW.image = 'link image'; end if; end // delimiter ;
ogsagwnx1#
建议使用表列 image 包含默认值并在插入时使用 insert into table1 values (5, DEFAULT) 如果有图像值,则希望使用默认值。
image
insert into table1 values (5, DEFAULT)
1条答案
按热度按时间ogsagwnx1#
建议使用表列
image
包含默认值并在插入时使用insert into table1 values (5, DEFAULT)
如果有图像值,则希望使用默认值。