ALTER TABLE TBPDV_CONFERENCIA_ITEM
    ADD USUARIO_ID INTEGER DEFAULT 0 NOT NULL;

SET TERM ^ ;

CREATE trigger ttbpdv_conferencia_item_b05i for tbpdv_conferencia_item
active before insert position 5
AS
BEGIN
    IF(COALESCE(NEW.USUARIO_ID, 0) = 0) THEN
    BEGIN
        NEW.USUARIO_ID = FN_CURRENT_USER_ID();
    END
END
^

SET TERM ; ^


ALTER TABLE TBPDV_CONFERENCIA_TROCA_ITEM
    ADD USUARIO_ID INTEGER DEFAULT 0 NOT NULL;

SET TERM ^ ;

CREATE trigger ttbpdv_conf_troca_item_b02i for tbpdv_conferencia_troca_item
active before insert position 2
AS
BEGIN
    IF(NEW.USUARIO_ID = 0) THEN
    BEGIN
        NEW.USUARIO_ID = FN_CURRENT_USER_ID();
    END
END
^

SET TERM ; ^

