Subject | Why IN AUTONOMOUS TRANSACTION doesnt work here? |
---|---|
Author | W O |
Post date | 2013-09-18T20:12:04Z |
Hello everybody
I have a table:
CREATE TABLE ERRORES (
ERR_MODULO VARCHAR(64),
ERR_COMENT VARCHAR(255));
and another table:
CREATE TABLE EMPLEADOS (
EMP_IDENTI BIGINT,
EMP_NOMBRE VARCHAR(20),
EMP_APELLD VARCHAR(20));
SET TERM ^ ;
CREATE TRIGGER EMPLEADOS_BIU FOR EMPLEADOS
ACTIVE BEFORE INSERT OR UPDATE
POSITION 1
AS
BEGIN
IN AUTONOMOUS TRANSACTION DO
INSERT INTO ERRORES
(ERR_MODULO, ERR_COMENT)
VALUES ('EMPLEADOS_BIU', '¿POR QUÉ ESTA FILA NO SE GRABA?');
END^
SET TERM ; ^
In the trigger EMPLEADOS_BIU is the sentence "INSERT INTO ERRORES..." but a row is inserted into the table ERRORES only if there are no errors.
This works fine:
INSERT INTO EMPLEADOS (EMP_NOMBRE, EMP_APELLD) VALUES ('JUAN', 'PEREZ');
but it doesnt work:
INSERT INTO EMPLEADOS (EMP_NOMBRE, EMP_APELLD) VALUES ('JUAN5678901234567890123', 'PEREZ');
because the length of EMP_NOMBRE is greater than 20, but:
Why is not a row inserted into the table ERRORES?
There is an IN AUTONOMOUS TRANSACTION in the trigger.
I am using Firebird 2.5.2, SuperServer, Windows 7 Ultimate, 32 bits
Greetings.
Walter.