CREATE TABLE FCM_ESCOPOSTAREFA ( 
	NRESCOPOSTAREFA     NUMBER  		NOT NULL,
	NMESCOPOSTAREFA     VARCHAR2(250)  	NOT NULL,
    NRORG             	NUMBER 	      	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
    IDATIVO           	VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
		CONSTRAINT CKC_IDATIVO_FCM_ESCOPOTAR CHECK (IDATIVO IN ('S','N')),
    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 FCM_ESCOPOSTAREFA PRIMARY KEY (NRESCOPOSTAREFA)
)
/

ALTER TABLE FCM_TAGSTAREFA ADD NRESCOPOSTAREFA NUMBER DEFAULT 1 NOT NULL
/

CREATE INDEX FCM00092_FK ON FCM_TAGSTAREFA (NRESCOPOSTAREFA ASC)
/

ALTER TABLE FCM_TAGSTAREFA
  ADD CONSTRAINT FKFCM00092ESCOPTAR_TAGSTAREF FOREIGN KEY (NRESCOPOSTAREFA)
      REFERENCES FCM_ESCOPOSTAREFA (NRESCOPOSTAREFA)
/