CREATE TABLE CCUSCLIEFILIAL (
	NRCCUSCLIEFILIAL	NUMBER 														NOT NULL,
	CDFILIAL 			VARCHAR2(4) 												NOT NULL,
	CDCLIENTE 			VARCHAR2(21) 												NOT NULL,
	CDCCUSCLIEFILIAL 	VARCHAR2(20) 												NOT NULL,
	NMCCUSCLIEFILIAL 	VARCHAR2(200) 												NULL,
	NRORG               NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')	NOT NULL,
	IDATIVO             VARCHAR2(1)		DEFAULT 'S' 								NOT NULL
		CONSTRAINT CKC_IDATIVO_CCUSCLIEFILIAL 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_CCUSCLIEFILIAL PRIMARY KEY (NRCCUSCLIEFILIAL),
	CONSTRAINT UN_CCUSCLIEFILIAL UNIQUE (CDFILIAL, CDCLIENTE, CDCCUSCLIEFILIAL),
	CONSTRAINT FKMYO00014FILIAL FOREIGN KEY (CDFILIAL) REFERENCES FILIAL (CDFILIAL),
	CONSTRAINT FKMYO00015CLIENTE FOREIGN KEY (CDCLIENTE) REFERENCES CLIENTE (CDCLIENTE)	
)
/
CREATE INDEX FKMYO00014FILIAL ON CCUSCLIEFILIAL (CDFILIAL)
/
CREATE INDEX FKMYO00015CLIENTE ON CCUSCLIEFILIAL (CDCLIENTE)
/
CREATE INDEX CCUSCLIEFILIAL_03 ON CCUSCLIEFILIAL (CDCCUSCLIEFILIAL)