In the create below you are using the column TS_RLZC_TREI
table ACDM_TREI_RLZD_ALU_EXCC
as a foreign key. However, the value of it that is a reference is updating whenever you give an update due to the create command.
#`TS_RLZC_TREI` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
The create would look like this:
CREATE TABLE IF NOT EXISTS `ACDM_TREI_RLZD_ALU_EXCC` (
`CD_ALU` bigint(20) NOT NULL,
`TS_RLZC_TREI` timestamp NOT NULL DEFAULT current_timestamp(), /*A alteração está aqui*/
`NR_EXCC` int(11) NOT NULL,
`CD_EXCC` int(11) NOT NULL,
`QT_SRE` int(11) NOT NULL,
`QT_RPTC` int(11) NOT NULL,
`HR_DESC` time DEFAULT NULL,
`QT_KG` decimal(15,3) DEFAULT NULL,
`HR_DRCO` time DEFAULT NULL,
`TX_OBS` varchar(255) DEFAULT NULL,
`TS_ULT_ALT` timestamp NOT NULL DEFAULT current_timestamp(),
`CD_USU_RSP` int(11) NOT NULL DEFAULT 0,
`EST_EXCC` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
This EST_EXCC column is referenced in another table?
– Bilico
No. She’s a regular column
– user129333
Sends the create table of this table.
– Bilico
I edited the question and put the create
– user129333
The update was normal here. UPDATE ACDM_TREI_RLZD_ALU_EXCC SET EST_EXCC = 'OK' WHERE CD_ALU = 1 AND date(TS_RLZC_TREI) = '2019-02-16' AND NR_EXCC= 1
– Bilico
anything sends the other Tables he uses as Foreign
– Bilico
I put in question the related tables
– user129333
Let’s go continue this discussion in chat.
– Bilico