1、错误描述
1 queries executed, 0 success, 1 errors, 0 warnings
查询:insert into emp values(6,‘胡迪‘,20,‘男‘)
错误代码: 1366
Incorrect integer value: ‘zhangsan‘ for column ‘depart_teacher‘ at row 1
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
2、错误原因
DELIMITER $$
CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
TRIGGER `test`.`insert_data` BEFORE INSERT
ON `test`.`emp`
FOR EACH ROW BEGIN
INSERT INTO t_depart_info(id,depart_name,depart_teacher) VALUES(3,‘you‘,‘zhangsan‘);
END$$
DELIMITER ;
INSERT INTO emp VALUES(6,‘胡迪‘,20,‘男‘);
触发器中插入的第三个记录的数据类型是int,但是插入的是varchar类型,导致报错
3、解决办法
(1)将t_depart_info表中的depart_teacher数据类型由int改为varchar
(2)触发器中插入depart_teacher由字符串改为整型
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow
错误代码 1366 Incorrect integer value 'zhangsan' for column 'd
原文地址:https://www.cnblogs.com/odejsjhshw/p/10382916.html
时间: 2024-10-10 03:20:33