ALTER TABLE PARAMTCO ADD CONSTRAINT FKPLA01008PERFILACESSO FOREIGN KEY (NRPERFILACESSO) REFERENCES PERFILACESSO (NRPERFILACESSO)
/
CREATE INDEX FKPLA01008PERFILACESSO ON PARAMTCO (NRPERFILACESSO)
/
ALTER TABLE PARAMTCO ADD CONSTRAINT FKPLA01009FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL)
/
CREATE INDEX FKPLA01009FILIAL ON PARAMTCO (CDFILIAL)
/
ALTER TABLE PARAMTCO ADD CONSTRAINT FKPLA01080TIPOPRAT FOREIGN KEY (CDTIPOPRATLIMPEZA) REFERENCES TIPOPRAT (CDTIPOPRAT)
/
CREATE INDEX FKPLA01080TIPOPRAT ON PARAMTCO (CDTIPOPRATLIMPEZA)
/
CREATE TABLE GERENTENEGOCIO (
	NRGERENTENEGOCIO		NUMBER 														NOT NULL,
    CDOPERADOR 				VARCHAR2(12) 												NOT NULL,
	CDOPERADORLIDER			VARCHAR2(12)												NULL,
	NRORG 					NUMBER			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 	NOT NULL,
	IDATIVO 				VARCHAR2(1) 	DEFAULT 'S' 								NOT NULL
		CONSTRAINT CKC_IDATIVO_GERENTENEGOCIO 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' 								NULL,
	CONSTRAINT PK_GERENTENEGOCIO PRIMARY KEY (NRGERENTENEGOCIO),
	CONSTRAINT UN_GERENTENEGOCIO UNIQUE (CDOPERADOR)
)