CREATE TABLE LOGINTEGRACAO
  (
    CDLOG             VARCHAR2(10)        NOT NULL,                         
    IDINTEGRACAO      VARCHAR2(10)        NOT NULL,
    CDFILIAL          VARCHAR2(4)  	  NULL,
    IDSTATUSLOG       VARCHAR2(1)         DEFAULT 'S' NULL,
		CONSTRAINT CKC_IDSTATUS_LOGINTEGRACAO CHECK (IDSTATUSLOG IN ('S','E', 'A')),
    DATALOG           DATE                DEFAULT SYSDATE,
    DSMENSAGEM        VARCHAR2(1000) 	  NOT NULL, 
    NRORG 	      NUMBER 		  DEFAULT 	SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
    IDATIVO	      VARCHAR2(1)	  DEFAULT 'S' 	NOT NULL,
		CONSTRAINT CKC_IDATIVO_LOGINTEGRACAO CHECK (IDATIVO IN ('S', 'N')),          
    DTULTATU          DATE           	  NULL,
    NRORGINCLUSAO     NUMBER         	  DEFAULT 1		NULL,
    CDOPERINCLUSAO    VARCHAR2(12)   	  DEFAULT '1'		NULL,
    NRORGULTATU       NUMBER         	  DEFAULT 1		NULL,
    DTINCLUSAO        DATE                DEFAULT SYSDATE, 
    		CONSTRAINT PK_LOGINTEGRACAO PRIMARY KEY (CDLOG)
)
/

ALTER TABLE LOGINTEGRACAO 
 	ADD CONSTRAINT FKVND00734LOGINTEGRACAO FOREIGN KEY (CDFILIAL) 
 		REFERENCES FILIAL(CDFILIAL)
/