Me explico mejor. Entiendo que la llamada al procdure sería algo así:
Código PHP:
EXCUTE PROCEDURE GEN_AFILIACION(45);
Ahora tengo definido un trigger de esta manera:
Código PHP:
CREATE TRIGGER Afiliacion_New_Reg FOR Afiliacion
ACTIVE BEFORE INSERT
POSITION 0
AS
BEGIN
IF (NEW.Codigo IS NULL) THEN
NEW.Codigo = GEN_ID(ID_Afiliacion, 1);
END;
Y definiendo el procedure como me has indicado en tu código, ¿el trigger debería quedar así?
Código PHP:
CREATE TRIGGER Afiliacion_New_Reg FOR Afiliacion
ACTIVE BEFORE INSERT
POSITION 0
AS
BEGIN
IF (NEW.Codigo IS NULL) THEN
NEW.Codigo = GEN_AFILIACION(45);
END;
Pero por lo que llevo leído en los triggers no pueden usarse variables y aquí es donde me pierdo del todo.