ALTER TABLE DETALHE_SERVICOROP ADD CONSTRAINT FKGOP00655FILIAL FOREIGN KEY (CDFILIAL, NRORG) REFERENCES FILIAL (CDFILIAL, NRORG)
/
ALTER TABLE DETALHE_SERVICOROP ADD CONSTRAINT PK_DETALHE_SERVICOROP PRIMARY KEY (NRSERVICOROP, NRORG)
/
CREATE UNIQUE INDEX UN_DETALHE_SERVICOROP ON DETALHE_SERVICOROP (CDFILIAL, CDSERVFILI, CDORDEM, IDDETALHESERVICO, NRORG)
/
ALTER TABLE DETALHE_SERVICOROP ADD CONSTRAINT CKC_IDDETALHESERVICO CHECK (IDDETALHESERVICO IN ('EFETIVO', 'RETIRADA'))
/
ALTER TABLE DETALHE_SERVICOROP ADD CONSTRAINT CKC_IDATIVO_DETALHE_SERVICOROP CHECK (IDATIVO IN ('S','N'))