CREATE TABLE PREPPRATPCARD (
	CDFILCENTPME   	VARCHAR2(4) 			 NOT NULL,
	CDTIPOCARD      VARCHAR2(10) 			 NOT NULL,
	CDFILAUXPRAT 	VARCHAR2(4)      		 NOT NULL,
	CDPRATO  		VARCHAR2(10)      		 NOT NULL,
	NRPREPTPCARD	VARCHAR2(2)      		 NULL,
	IDPREPTPCARD	VARCHAR2(1)  DEFAULT '2' NOT NULL,	
	TXPREPTPCARD	CLOB,
	NMPREPTPCARD	VARCHAR2(50),
	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'     							NULL,
		CONSTRAINT CKC_IDATIVO_PREPPRATPCARD CHECK (IDATIVO IN ('S', 'N')),
		CONSTRAINT CKC_IDPREPTPCARD CHECK (IDPREPTPCARD IN ('1', '2')),
		CONSTRAINT PK_PREPPRATPCARD PRIMARY KEY (CDFILCENTPME, CDTIPOCARD, CDFILAUXPRAT, CDPRATO, NRPREPTPCARD)
)
/
ALTER TABLE PREPPRATPCARD ADD CONSTRAINT FKPLA01309PRATO FOREIGN KEY (CDFILAUXPRAT, CDPRATO)
		REFERENCES PRATO (CDFILAUXPRAT, CDPRATO)
/
CREATE INDEX PLA01309_FK ON PREPPRATPCARD (CDFILAUXPRAT ASC, CDPRATO ASC)
/
ALTER TABLE PREPPRATPCARD ADD CONSTRAINT FKPLA013010PADRAOQUALIDADE FOREIGN KEY (CDFILCENTPME, CDTIPOCARD)
		REFERENCES PADRAOQUALIDADE (CDFILCENTPME,CDTIPOCARD)
/
CREATE INDEX PLA01310_FK ON PREPPRATPCARD (CDFILCENTPME ASC, CDTIPOCARD ASC)