
CREATE trigger ttbprogramacao_b8u for tbprogramacao
active before update position 0
AS
begin
  if(old.gp_id <> new.gp_id and new.status = 3)then
  begin
     new.gp_id = old.gp_id;
  end
end;

COMMENT ON TRIGGER TTBPROGRAMACAO_B8U IS 'desfaz a alteracao do gp caso um talao ja esteja produzido';

