ALTER TABLE DEDUCAOROP ADD CDLOJA VARCHAR2(10) NULL
/
ALTER TABLE CONTRATOCLIENTE ADD CDEMPRESA VARCHAR2(2) NULL
/

ALTER TABLE CONTRATOCLIENTE ADD CONSTRAINT FK_DADOSEMPRESA
   FOREIGN KEY (CDEMPRESA)REFERENCES EMPRESA (CDEMPRESA)
/
 
ALTER TABLE CONTRATOCLIENTE ADD CDOPERADOR VARCHAR2(12) NULL
/

ALTER TABLE CONTRATOCLIENTE ADD CONSTRAINT FK_CDOPERCONTRCLI
   FOREIGN KEY (CDOPERADOR) REFERENCES OPERADOR (CDOPERADOR)
/
CREATE TABLE LOGALTCONTPROP (
   CDOPERADOR VARCHAR2(12),
   DTOPERACAO DATE, 
   NMTABELA VARCHAR2(30),
   IDOPERACAO VARCHAR2(10),
   NRORG NUMBER DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO VARCHAR2(1) DEFAULT 'S' NOT NULL
   CONSTRAINT CKC_IDATIVO_LOGALTCONTPROP CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO DATE NULL,
   DTULTATU DATE NULL,
   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'
)
/ 