Ad

Issue With TRIGGER INSERT

- 1 answer

I got this code of my trigger but it isn't working for some reason

    CREATE TRIGGER copia_detalle_xml AFTER INSERT ON tif_detallexml
FOR EACH ROW 
INSERT INTO tbl_rif (id, idDetalleXml, total_xml, subtotal_xml, iva_xml, fecha_operacion)
VALUES (new.idContador, new.idDetalleXml, new.doubleTotal, new.doubleSubtotal,new.duobleTotalImpuestosTrasladados, NOW());

I checked the name of this field many times and it's correct "new.duobleTotalImpuestosTrasladados"

It is inserting the data correctly in the table but not the field "duobleTotalImpuestosTrasladados", and I have no idea why, I hope you can help me to find the issue with my code.

INFO UPDATED

This is from "tbl_rif"

enter image description here

This is from tif_detallexml

enter image description here

where the field "iva_xml" is 0 it should be 13.79

Ad

Answer

I solved the problem, the problem was that I was working with code made by other person where I got all the info of the XML and I didn't see that there was a line where the field that I required was being updated not inserted, that is why the trigger "wasn't working", thank you all for you help and sorry.

Ad
source: stackoverflow.com
Ad