CREATE TABLE FCM_TIPOLOCALCLI(
	NRTIPOLOCALCLI    NUMBER       NOT NULL,
	NMTIPOLOCALCLI    VARCHAR2(150)  NOT NULL,
	IDTIPOLOCALCLI    VARCHAR2(1) DEFAULT '3' NOT NULL
		CONSTRAINT CHK_IDTIPOLOCALCLI CHECK (IDTIPOLOCALCLI IN ('1', '2', 3)),
	NRCHECKLISTPADR   NUMBER,
	DSICONETIPOLOCAL  VARCHAR2(4000),
	DSTIPOLOCALCLI    VARCHAR2(4000),
	NRORG             NUMBER 	     DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
	IDATIVO           VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
		CONSTRAINT CHK_IDATIVO_FCM_TIPOLOCALCLI 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',
		CONSTRAINT PK_FCM_TIPOLOCALCLI PRIMARY KEY (NRTIPOLOCALCLI)	
)
/

CREATE TABLE FCM_FOTOTAREFAGERCHK(
  NRFOTOTAREFAGERCHK  	NUMBER  		NOT NULL,
  NRTAREFAGERCHK      	NUMBER  		NOT NULL,
  DSFOTOTAREFAGERCHK  	VARCHAR2(1000)  NOT NULL,
  NRORG             	NUMBER 	     	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
  IDATIVO           	VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
      CONSTRAINT CHK_IDATIVO_FCM_FOTOTARCHK 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'
)
/

ALTER TABLE FCM_FOTOTAREFAGERCHK ADD CONSTRAINT PK_FCM_FOTOTAREFAGERCHK PRIMARY KEY (NRFOTOTAREFAGERCHK)
/

CREATE INDEX FCM00055_FK ON FCM_FOTOTAREFAGERCHK (NRTAREFAGERCHK ASC)
/

ALTER TABLE FCM_FOTOTAREFAGERCHK 
  ADD CONSTRAINT FKFCM00055TARCHK_FOTOTARCHK FOREIGN KEY (NRTAREFAGERCHK)
      REFERENCES FCM_TAREFAGERCHK (NRTAREFAGERCHK)
/ 