SET TERM ^ ;



CREATE OR ALTER TRIGGER PJE_AVISOS_PENDENTES_BI FOR PJE_AVISOS_PENDENTES
ACTIVE BEFORE INSERT POSITION 0
as
begin
  if (new.codigo is null) then
    new.codigo = gen_id(gen_pje_avisos_pendentes_id,1);
end
^
SET TERM ; ^

SET TERM ^ ;



CREATE OR ALTER TRIGGER PJE_AVISOS_PENDENTES_DATA_INC FOR PJE_AVISOS_PENDENTES
ACTIVE BEFORE INSERT POSITION 1
AS
begin
  new.data_inc = current_timestamp;
end
^
SET TERM ; ^