MySQL Forums
Forum List  »  Triggers

Re: Triggers question!
Posted by: Max Molina
Date: August 25, 2016 10:06PM

I understand why its bad practice, after a lot more reading. However due to the statistical analysis software im suing, and for the sake of data reading of some of the users, we do it this way. Thanks for the tip, I'll keep it in mind since im already using a foreign key.

I have a different issue now. I-ve succefully created the following trigger>

DELIMITER $$
CREATE TRIGGER `aio_mtltp` AFTER INSERT ON `master_table_ltp`
FOR EACH ROW
BEGIN
IF (master_table_ltp.IMHQ_solicitada = 'Si') THEN
INSERT INTO imhq(RECORD_ID, Tipo_de_Estudio, Año, Codigo_Interno, Iniciales_del_Px, Edad, Sexo)
VALUES (NEW.RECORD_ID, NEW.Tipo_de_Estudio, NEW.Año, NEW.Codigo_Interno, NEW.Edad, NEW.Sexo, NEW.Iniciales_del_Px);
END IF;
END;$$
DELIMITER ;

Andim trying to add a record to a table, like this>

INSERT INTO `master_table_ltp` (`RECORD_ID`, `Tipo_de_Estudio`, `Año`, `Codigo_Interno`, `Iniciales_del_Px`, `Sexo`, `Edad`, `Servicio_Solicitante`, `Roche_Hospital`, `Especimen`, `Macro`, `Diagnóstico`, `Validado_por`, `Subtipo_de_Linfoma_T`, `Laminillas_Obtenidas`, `Laminillas_representativas`, `Caso_revisado`, `Bloque_Obtenido`, `Punch`, `IMQH_Solicitada`, `N_de_Marcadores_Solicitados`) VALUES (NULL, 'P', '13', '4566', 'MMA', 'M', '28', 'Hospital Universitario', NULL, 'bto', 'bto', 'bto', 'bto', 'bto', 'SI', 'bto', 'NO', 'NO', 'NO', 'SI', '6')

and it gives me back the following error>

#1109 - Unknown table 'master_table_ltp' in field list

Any ideas where i went wrong?

The mysql code is created by phpMyadmin. So im kinda confused.

Options: ReplyQuote


Subject
Views
Written By
Posted
1026
August 25, 2016 03:09PM
433
August 25, 2016 06:35PM
Re: Triggers question!
495
August 25, 2016 10:06PM
390
August 26, 2016 08:48AM
486
August 26, 2016 02:51PM
467
August 26, 2016 07:26PM


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.