MySQL Forums
Forum List  »  Triggers

Simple Trigger asistance!
Posted by: Max Molina
Date: August 25, 2016 07:19PM

im Using phpMyAdmin to manage a DB for research in a Hospital, and I have almost everything set up, save for one thing.

When certain value on a column on my master_table is inserted/updated to 'yes', I need this record and its values from columns A,B,C,D etc... inserted into a new row in another table. So, I decided a trigger would bge perfect, since they work on insert, updates and deletes. Using mysql 5.7.

Don't suggest views, I don't need a view. I need a TABLE to handle this information, and for other developing purposes.

So, here it is >

BEGIN
IF
NEW.IMHQ_solicitada = Si THEN
INSERT INTO imhq SET RECORD_ID = NEW.RECORD_ID, Tipo_de_Estudio = NEW.Tipo_de_Estudio, Año = NEW.Año, Codigo_Interno = NEW.Codigo_Interno,Edad = NEW.Edad, Sexo = NEW.Sexo, V = NEW.Iniciales_del_ Px;
END IF;
END;


The missing code is generated by phpMyAdmin. This gives me A syntax error though. Any ideas?

Options: ReplyQuote


Subject
Views
Written By
Posted
Simple Trigger asistance!
944
August 25, 2016 07:19PM
518
August 25, 2016 07:22PM
450
August 25, 2016 07:24PM
430
August 26, 2016 09:06AM
406
August 26, 2016 02:45PM


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.