DROP INDEX MAN01098_FK
/

ALTER TABLE ETAFABRICOP
    DROP CONSTRAINT FKMAN01098ORDPRODU
/

CREATE INDEX MAN01098_FK ON ETAFABRICOP  (CDFILIAL ASC, NRORDPROD ASC, NRSUBORDPROD ASC)
/

ALTER TABLE ETAFABRICOP
    ADD CONSTRAINT FKMAN01098ORDPRODU FOREIGN KEY  (CDFILIAL, NRORDPROD, NRSUBORDPROD)
       REFERENCES ORDPRODUCAO (CDFILIAL, NRORDPROD, NRSUBORDPROD) ON DELETE CASCADE
/

DROP INDEX MAN01193_FK
/

ALTER TABLE RETIRADAESTO
    DROP CONSTRAINT FKMAN01193ETAFABRI
/

CREATE INDEX MAN01193_FK ON RETIRADAESTO  (CDFILIAL ASC, NRORDPROD ASC, NRSUBORDPROD ASC, CDETAPAPROD ASC)
/

ALTER TABLE RETIRADAESTO
    ADD CONSTRAINT FKMAN01193ETAFABRI FOREIGN KEY  (CDFILIAL, NRORDPROD, NRSUBORDPROD, CDETAPAPROD)
       REFERENCES ETAFABRICOP (CDFILIAL, NRORDPROD, NRSUBORDPROD, CDETAPAPROD) ON DELETE CASCADE
/

DROP INDEX MAN01229_FK
/

ALTER TABLE PRODACABADO
    DROP CONSTRAINT FKMAN01229SUBPRETA
/

CREATE INDEX MAN01229_FK ON PRODACABADO  (CDFILIAL ASC, NRORDPROD ASC, NRSUBORDPROD ASC, CDSUBPRODETA ASC, NRSUBPRETAOP ASC)
/

ALTER TABLE PRODACABADO
    ADD CONSTRAINT FKMAN01229SUBPRETA FOREIGN KEY  (CDFILIAL, NRORDPROD, NRSUBORDPROD, CDSUBPRODETA, NRSUBPRETAOP)
       REFERENCES SUBPRETAPAOP (CDFILIAL, NRORDPROD, NRSUBORDPROD, CDSUBPRODETA, NRSUBPRETAOP) ON DELETE CASCADE
/

DROP INDEX GSQ00048_FK
/

ALTER TABLE INSPECAUDIT
    DROP CONSTRAINT FKGSQ00048AUDITORI
/

CREATE INDEX GSQ00048_FK ON INSPECAUDIT (CDFILIAL ASC, NRAUDITORIA ASC)
/

ALTER TABLE INSPECAUDIT
    ADD CONSTRAINT FKGSQ00048AUDITORI FOREIGN KEY  (CDFILIAL, NRAUDITORIA)
       REFERENCES AUDITORIA (CDFILIAL, NRAUDITORIA) ON DELETE CASCADE
/