Issue With TRIGGER INSERT
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"
This is from tif_detallexml
where the field "iva_xml" is 0 it should be 13.79
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.
Related Questions
- → I can't do a foreign key, constraint error
- → How to implement DbDongle::convertTimestamps as workaround of invalid timestamps with MySql strict
- → MySQL error "Foreign key constraint is incorrectly formed"
- → Eloquent Multitable query
- → "Laravel 5.1" add user and project with userId
- → Database backup with custom code in laravel 5 and get the data upto 10 rows from per table in database
- → Laravel 5.1 QueryException when trying to delete a project
- → Using Array in '->where()' for Laravel Query Building
- → Chaining "Count of Columns" of a Method to Single Query Builder
- → Laravel Eloquent Joining Strange query
- → convert time using mysql laravel 5
- → How to update a column after an expiration date in MySQL?
- → Foreign key constraint fails on existing key