CREATE TABLE FCM_ITEMCHECKLISTESC (
	NRITEMCHECKLISTESC  NUMBER 			NOT NULL,
	NRITEMCHECKLIST     NUMBER          NOT NULL,
	NRESCOPOSTAREFA     NUMBER 			NOT NULL,	
	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',
		CONSTRAINT CKC_IDATIVO_FCM_ITLISTESC CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_FCM_ITEMCHECKLISTESC 	 PRIMARY KEY (NRITEMCHECKLISTESC),
		CONSTRAINT FKFCM00169ITEMCHECKLISTEC_ITEM FOREIGN KEY (NRITEMCHECKLIST) REFERENCES FCM_ITEMCHECKLIST (NRITEMCHECKLIST),
		CONSTRAINT FKFCM00170ITEMCHECKLISTEC_ESCO FOREIGN KEY (NRESCOPOSTAREFA) REFERENCES FCM_ESCOPOSTAREFA (NRESCOPOSTAREFA)
)
/
CREATE INDEX FCM00169_FK ON FCM_ITEMCHECKLISTESC (NRITEMCHECKLIST ASC)
/
CREATE INDEX FCM00170_FK ON FCM_ITEMCHECKLISTESC (NRESCOPOSTAREFA ASC)
/

CREATE TABLE FCM_ITEMCHECKLISTCRIT (
	NRITEMCHECKLISTCRIT NUMBER 			NOT NULL,
	NRITEMCHECKLIST   	NUMBER 			NOT NULL,
	NRCRITERIOTAREFA  	NUMBER 			NOT NULL,
	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',
		CONSTRAINT CKC_IDATIVO_FCM_ITLISTCRIT CHECK (IDATIVO IN ('S','N')),
		CONSTRAINT PK_FCM_ITEMCHECKLISTCRIT   PRIMARY KEY (NRITEMCHECKLISTCRIT),
		CONSTRAINT FKFCM00171ITEMCHECLITCRIT_ITEM FOREIGN KEY (NRITEMCHECKLIST)  REFERENCES FCM_ITEMCHECKLIST  (NRITEMCHECKLIST),
		CONSTRAINT FKFCM00172ITEMCHECLITCRIT_CRIT FOREIGN KEY (NRCRITERIOTAREFA) REFERENCES FCM_CRITERIOTAREFA (NRCRITERIOTAREFA)
)
/
CREATE INDEX FCM00171_FK ON FCM_ITEMCHECKLISTCRIT (NRITEMCHECKLIST ASC)
/
CREATE INDEX FCM00172_FK ON FCM_ITEMCHECKLISTCRIT (NRCRITERIOTAREFA ASC)
/