Re: Trigger - ERROR 1054: 1054: Unknown column
I can't use NEW because I obtain an error when I attempt to insert the trigger
Show create table as you requested:
'tb0503_op_st', 'CREATE TABLE `tb0503_op_st`
(\n `c0503_01_Id` int(11) NOT NULL AUTO_INCREMENT,\n
`c0503_02_Nom` varchar(45) DEFAULT NULL COMMENT \'PB05/04/2020: nome \',\n
`c0503_03_TS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n
`c0503_04_str` int(11) NOT NULL COMMENT \'PB05/04/2020: strumento \',\n
`c0503_05_Ann` tinyint(4) DEFAULT \'0\' COMMENT \'PB05/04/2020: 0 attivo, 1 annullato\',\n
`c0503_06_ChOp` double DEFAULT NULL COMMENT \'PB05/04/2020: tasso \',\n
`c0503_07_DivOp` int(11) DEFAULT NULL COMMENT \'PB05/04/2020: divisa \',\n
`c0503_08_QuOp` double NOT NULL COMMENT \'PB05/04/2020: quantità \',\n
`c0503_09_DaOp` date DEFAULT NULL COMMENT \'PB05/04/2020: data ope\',\n
`c0503_10_DaVa` date DEFAULT NULL COMMENT \'PB05/04/2020: data va\',\n
`c0503_11_cmm` double DEFAULT NULL COMMENT \'PB06/04/2020: comm\',\n
`c0503_12_CmDv` int(11) DEFAULT NULL COMMENT \'PB06/04/2020: div\',\n
`c0503_19_CmCh` double DEFAULT NULL COMMENT \'PB06/04/2020: tasso \',\n
`c0503_13_ContrOp` double DEFAULT NULL COMMENT \'PB06/04/2020: contr\',\n
`c0503_14_ContrCm` double DEFAULT NULL COMMENT \'PB06/04/2020: contro\',\n
`c0503_15_ContrTot` double DEFAULT NULL COMMENT \'PB06/04/2020: contr\',\n
`c0503_16_AcVe` tinyint(4) DEFAULT NULL COMMENT \'PB06/04/2020: acquisto 1, vendita 0\',\n
`c0503_17_Sto` text COMMENT \'PB06/04/2020: storico modifiche\',\n
`c0503_18_ValQu` double NOT NULL COMMENT \'PB06/04/2020: prezzo \',\n
`c0503_20_Bank` int(11) DEFAULT NULL COMMENT \'PB07/04/2020: banca.\',\n
`c0503_21_CSE` varchar(45) DEFAULT NULL COMMENT \'PB12/04/2020: sistemi esterni.\',\n
PRIMARY KEY (`c0503_01_Id`),\n KEY `FK_0503_0500_01_idx` (`c0503_04_str`)\n) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT=\'PB05/04/2020: tabella operazioni inserimento\''
'tb0507_dep_tit', 'CREATE TABLE `tb0507_dep_tit` (\n
`c0507_01_Id` int(11) NOT NULL AUTO_INCREMENT,\n
`c0507_02_TS` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n
`c0507_03_Sto` mediumtext COMMENT \'PB13/04/2020: storico modifiche\',\n
`c0507_04_Ann` tinyint(4) DEFAULT \'0\' COMMENT \'PB13/04/2020: attivo 0, annullato 1\',\n
`c0507_05_CSE` char(15) DEFAULT NULL COMMENT \'PB13/04/2020: Sistemi Esterni\',\n
`c0507_06_Note` mediumtext COMMENT \'PB13/04/2020: note del record.\',\n
`c0507_07_Str` int(11) DEFAULT NULL COMMENT \'PB13/04/2020: strumento inserito.\',\n
`c0507_08_Qu` double DEFAULT \'0\' COMMENT \'PB13/04/2020: quantità .\',\n
`c0507_09_Avg` double DEFAULT NULL COMMENT \'PB13/04/2020: medio di carico\',\n
PRIMARY KEY (`c0507_01_Id`),\n
KEY `FK_0507_0503_01_idx` (`c0507_07_Str`),\n CONSTRAINT `FK_0507_0503_01` FOREIGN KEY (`c0507_07_Str`) REFERENCES `tb0503_op_st` (`c0503_01_id`)\n) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT=\'PB13/04/2020: deposito\''