@PHOLHAD
@EXECSQL CREATE EXCEPTION ERRO_PHCCAD 'ESTOU ZERANDO A DATA DA RESCISAO PHCCAD';
@EXECSQL CREATE EXCEPTION ERRO_PHCRES 'ESTOU ZERANDO A DATA DA RESCISAO PHCRES';

CREATE TRIGGER VERIFICA_PHCCAD FOR PHCCAD
ACTIVE BEFORE UPDATE POSITION 0
AS

begin 
if ((phcCad.DatDem = '00/00/0000' or
     phcCad.DatDem = '' or
     PhcCad.DatDem is null) and
    (PhcCAd.ZerDem <> 'S'))
then
    Exception ERRO_PHCCAD ;
end;
@EXECSQL


CREATE TRIGGER VERIFICA_PHCRES FOR PHCRES
ACTIVE BEFORE UPDATE POSITION 0
AS

begin 
  if  (Phcres.DatDem = '00/00/0000' or
       PhcRes.DatDem = '' or
       Phcres.DatDem is null)
  then
     Exception ERRO_PHCRES;
end;
@EXECSQL

