ALTER TABLE ITEMSOLI ADD NRSEQRUPTURAOL VARCHAR2(10)  
/

ALTER TABLE ITEMAUTF ADD DSLISTAITINCONS VARCHAR2(500)
/

CREATE INDEX IN_ITEMAUTF_9955 ON ITEMAUTF (CDFILDESTORIG, CDFILLANCORIG, NRAUTOFORNORIG, CDMARCAORIG, CDPRODUTOORIG, DTPROGENTAFORIG) 
/

ALTER TABLE AUTOFORNE ADD DSLISTAINCONS VARCHAR2(500)
/

ALTER TABLE RUPTURAOL ADD DATAINI DATE
/

ALTER TABLE RUPTURAOL ADD DATAFIN DATE
/

ALTER TABLE RUPTURAOL ADD PRODINI VARCHAR2(20)
/

ALTER TABLE RUPTURAOL ADD PRODFIN VARCHAR2(20)
/

ALTER TABLE RUPTURAOL ADD LISTCDOPERADOR VARCHAR2(1500)
/

ALTER TABLE RUPTURAOL ADD  LISTCDFILDEST VARCHAR2(1500)
/

ALTER TABLE RUPTURAOL ADD LISTA_ENVIOAFFORN VARCHAR2 (1000)
/

ALTER TABLE RUPTURAOL ADD IDDESBLOQUEIO VARCHAR2(1) NULL
    CONSTRAINT CKC_IDDESBLOQUEIO CHECK (IDDESBLOQUEIO IS NULL OR (IDDESBLOQUEIO IN ('S','N')))
/

CREATE INDEX IN_ENVIOAFFON_9999 ON ENVIOAFFORN(CDFORNECED, DTENTREGAFFORN)
/

CREATE TABLE LOGRUPTURAOLAUT(
	NRLOGRUPTURAOLAUT INTEGER    	  NOT NULL,
	NRSEQRUPTURAOL    VARCHAR2(10)    NOT NULL,
	CDFILIAL          VARCHAR2(4)     NOT NULl,
	DTOPERACAO        DATE,
	CDFORNECED        VARCHAR2(21),
	DSPROCESSO        VARCHAR2(100),
	LISTAAF           VARCHAR2(1000),
	DSERRO            VARCHAR2(2000),
	IDNOTIFICACAO     VARCHAR2(1),
	NRORG             NUMBER 	      DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           VARCHAR2(1)     DEFAULT 'S'					NOT NULL,
    DTINCLUSAO        DATE            DEFAULT SYSDATE,
    DTULTATU          DATE            DEFAULT SYSDATE,
    NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 					NULL,
    NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
    CDOPERULTATU      VARCHAR2(12)    DEFAULT '1',
		CONSTRAINT CKC_LOGRUPTURAOLAUT_IDNOTIFIC CHECK (IDNOTIFICACAO IS NULL OR (IDNOTIFICACAO IN ('S', 'N'))),
		CONSTRAINT CKC_IDATIVO_LOGRUPTURAOLAUT  CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_NRLOGRUPTURAOLAUT PRIMARY KEY(NRLOGRUPTURAOLAUT),
		CONSTRAINT FKFKCMP00607NRLOGRUPTURAOLAUT FOREIGN KEY(NRSEQRUPTURAOL, CDFILIAL)  REFERENCES  RUPTURAOL (NRSEQRUPTURAOL, CDFILIAL) ON DELETE CASCADE
)
/

CREATE INDEX CMP00609_FK ON  LOGRUPTURAOLAUT (NRSEQRUPTURAOL ASC, CDFILIAL)
/

CREATE INDEX CMP00607_FK ON  LOGRUPTURAOLAUT (NRSEQRUPTURAOL ASC, CDFILIAL, CDFORNECED)
/

DROP SEQUENCE SEQ_NRLOGRUPTURAOLAUT
/

CREATE SEQUENCE SEQ_NRLOGRUPTURAOLAUT INCREMENT BY 1 MINVALUE 1
/

ALTER TABLE PARASUPRI ADD DSEMAILCONCLAUTRUPOL VARCHAR2(400)
/

ALTER TABLE PARASUPRI ADD DSURLCONCLAUTRUPOL VARCHAR2(400)
/

TRUNCATE TABLE ITEMAUTF_CLONE
/
ALTER TABLE ITEMAUTF_CLONE ADD CONSTRAINT FKCMP00608ITEMUTF_CLON_ITEMUTF FOREIGN KEY (NRAUTOFORN, CDFILDEST, CDFILLANC, CDMARCA, CDPRODUTO, DTNEWENTAF)
	REFERENCES ITEMAUTF (NRAUTOFORN, CDFILDEST, CDFILLANC, CDMARCA, CDPRODUTO, DTPROGENTAF) ON DELETE CASCADE
/

DROP INDEX CMP00608_FK
/

CREATE INDEX CMP00608_FK ON ITEMAUTF_CLONE (NRAUTOFORN ASC, CDFILDEST ASC, CDFILLANC ASC, CDMARCA ASC, CDPRODUTO ASC, DTNEWENTAF ASC)
/

CREATE TABLE PRAZOFORNEXPEDFILPROD (
    NRPRAZOFORNEXPEDPROD NUMBER            NOT NULL,
    CDFORNECED           VARCHAR2(21)      NOT NULL, 
    CDFILIAL             VARCHAR2(4)       NOT NULL,
    CDPRODUTO            VARCHAR2(10)      NOT NULL,
    QTDIASPRAZOEXPED     FLOAT(126),
    NRORG                 NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')         NOT NULL,
    IDATIVO               VARCHAR2(1)     DEFAULT 'S'                    NOT NULL,
    DTINCLUSAO            DATE            DEFAULT SYSDATE,
    DTULTATU              DATE            DEFAULT SYSDATE,
    NRORGINCLUSAO         NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')        NULL,
    CDOPERINCLUSAO        VARCHAR2(12)    DEFAULT '1'                     NULL,
    NRORGULTATU            NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')        NULL,
    CDOPERULTATU           VARCHAR2(12)    DEFAULT '1',
       CONSTRAINT CKC_IDATIVO_PRZFORNEXPFILPR CHECK (IDATIVO IN ('S','N')),
       CONSTRAINT PK_PRAZOFORNEXPEDFILPROD PRIMARY KEY (NRPRAZOFORNEXPEDPROD)
)
/
CREATE INDEX IN_PRAZOFORNEXPEDFILPROD_02 ON PRAZOFORNEXPEDFILPROD(CDFORNECED, CDFILIAL, CDPRODUTO)
/

CREATE SEQUENCE SEQ_PRAZOFORNEXPEDFILPROD START WITH 1 INCREMENT BY 1
/

CREATE INDEX CMP00610_IN ON AUTOFORNE (DTAUTOFORN ASC)
/

CREATE INDEX CMP00611_IN ON LOGAUTOFORNE(CDFILDESLAF, CDFILLANLAF, NRAUTFORLAF ASC)
/