1. Error description
1 queries executed, 0 success, 1 errors, 0 warnings
query: INSERT INTO EMP values (6, ' Woody ', 20, ' Male ')
error code: 1366
Incorr ECT integer value: ' Zhangsan ' for column ' Depart_teacher ' at row 1
execution Time: 0 sec
Delivery: 0 SEC
Total time-consuming : 0 sec
2. Error reason
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, ' Woody ', 20, ' male ');
The data type of the third record inserted in the trigger is int, but the varchar type is inserted, resulting in an error
3. Solutions
(1) Change the Depart_teacher data type in the T_depart_info table from int to varchar
(2) Insert Depart_teacher in trigger by string to Integer