CREATE TABLE UPDATERCONFIGCX
(
    ID                NUMBER 		  NOT NULL,
    CDFILIAL          VARCHAR2(4) 	  NOT NULL,
    CDCAIXA           VARCHAR2(3) 	  NOT NULL,
    CONFIG            VARCHAR2(4000)  NOT NULL,
	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_UPDATERCONFIGCX CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_UPDATERCONFIGCX PRIMARY KEY (ID),
		CONSTRAINT FKVND00868UPDATECONFICXFILI FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
)
/

CREATE INDEX VND00868_FK ON UPDATERCONFIGCX(CDFILIAL)
/

CREATE SEQUENCE SEQ_UPDATERCONFIGCX START WITH 1 MINVALUE 1 INCREMENT BY 1
/

CREATE TABLE UPDATERCONFIGHISTCX
(
	ID                NUMBER 		  NOT NULL,
	UPDATERCONFIGID   NUMBER 		  NOT NULL,
	CDOPERADOR        VARCHAR2(12)    NOT NULL,
	CONFIG            VARCHAR2(4000)  NOT NULL,
	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_UPDATECONFIGHISTCX CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_UPDATERCONFIGHISTCX PRIMARY KEY (ID),
		CONSTRAINT FKVND00869UPDATCONFHISCXCONFID FOREIGN KEY (UPDATERCONFIGID) REFERENCES UPDATERCONFIGCX (ID),
		CONSTRAINT FKVND00870UPDATECONFGHISCXOP FOREIGN KEY (CDOPERADOR) REFERENCES OPERADOR (CDOPERADOR)
)
/

CREATE INDEX VND00869_FK ON UPDATERCONFIGHISTCX(UPDATERCONFIGID)
/

CREATE INDEX VND00870_FK ON UPDATERCONFIGHISTCX(CDOPERADOR)
/

CREATE SEQUENCE SEQ_UPDATERCONFIGHISTCX START WITH 1 MINVALUE 1 INCREMENT BY 1
/

