Trigger - ERROR 1054: 1054: Unknown column
Good evening to everyone,
I have this error in a trigger of a table that insert or update a row in another table. It works well when insert a row in the other table. It goes wrong when update and get this error "ERROR 1054: 1054: Unknown column 'c0507_08_Qu' in 'field list'"
Segue listato del trigger.
Thank you
CREATE DEFINER=`root`@`localhost` TRIGGER `tb0503AFTER_INSERT` AFTER INSERT ON `tb0503_op_st` FOR EACH ROW BEGIN
DECLARE Numero INT(11);
SELECT COUNT(*) INTO Numero
FROM `test-import`.`tb0507_dep_tit`
WHERE `c0507_07_Str`=NEW.c0503_04_str;
IF Numero=0 THEN
INSERT INTO `test-import`.`tb0507_dep_tit`
(`c0507_07_Str`, c0507_08_Qu, c0507_09_Avg)
VALUES (NEW.`c0503_04_str`, NEW.c0503_08_QuOp, NEW.c0503_18_ValQu) ;
ELSE
SET @c08=`c0507_08_Qu` + NEW.c0503_08_QuOp;
UPDATE `test-import`.`tb0507_dep_tit`
SET `c0507_08_Qu` = @c08
WHERE `tb0507_dep_tit`.`c0507_07_Str` = NEW.`c0503_04_str`;
END IF;
END
Subject
Views
Written By
Posted
Trigger - ERROR 1054: 1054: Unknown column
3567
April 13, 2020 11:40AM
792
April 13, 2020 01:00PM
729
April 13, 2020 02:22PM
640
April 13, 2020 03:43PM
595
April 14, 2020 01:11AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.