CREATE TABLE DIACARDTRAB (
	NRDIACARDTRAB			NUMBER 														NOT NULL,
    NRCARDAPIOTRAB 			NUMBER														NOT NULL,
    NRSEMANA 				NUMBER														NOT NULL,
	NRDIASEMANA 			NUMBER														NOT NULL,
    QTCOMENSAIS 			FLOAT														NOT NULL,
	NRORG 					NUMBER			DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 	NOT NULL,
	IDATIVO 				VARCHAR2(1) 	DEFAULT 'S' 								NOT NULL
		CONSTRAINT CKC_IDATIVO_DIACARDTRAB 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_DIACARDTRAB PRIMARY KEY (NRDIACARDTRAB),
	CONSTRAINT UN_DIACARDTRAB UNIQUE (NRCARDAPIOTRAB, NRSEMANA, NRDIASEMANA)
)
/
ALTER TABLE DIACARDTRAB ADD
	CONSTRAINT FKPLA01084CARDAPIOTRAB FOREIGN KEY (NRCARDAPIOTRAB)
		REFERENCES CARDAPIOTRAB (NRCARDAPIOTRAB)
/
CREATE INDEX FKPLA01084CARDAPIOTRAB ON DIACARDTRAB (NRCARDAPIOTRAB)