declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE MONITORAMENTO_CCF 
	(
		MONITORAMENTOCCF_ID NUMBER(7,0) NOT NULL ,
		EMPRESA_ID NUMBER(7,0),
		UF_INSTALACAO NUMBER(7,0),
		FISCALIMPRESSORA_ID NUMBER(7,0),
		DATA_OCORRENCIA DATE, 
		PUNTOVENTA_ID NUMBER(7,0),
		USUARIO_ID NUMBER(7,0), 
		SEQUENCIA_CCF_QUEBRADA NUMBER(7,0), 
		DATA_MONITORAMENTO DATE,
        DIAS_ALERTA_ABERTO DATE,
        REPROCESSADO NUMBER(1,0),
		ACTIVO NUMBER(1,0), 
		FECMODIF DATE, 
		USUARIOMODIF_ID NUMBER(7,0), 
	    CONSTRAINT MONITORAMENTO_CCF_PK PRIMARY KEY (MONITORAMENTOCCF_ID) ENABLE ,
	    CONSTRAINT FK_MCCF_PUNTOVENTA FOREIGN KEY (PUNTOVENTA_ID) REFERENCES PUNTO_VENTA (PUNTOVENTA_ID) ENABLE,
	    CONSTRAINT FK_MCCF_USUARIO FOREIGN KEY (USUARIO_ID) REFERENCES USUARIO (USUARIO_ID) ENABLE,
		CONSTRAINT FK_MCCF_USUARIOMODIF FOREIGN KEY (USUARIOMODIF_ID) REFERENCES USUARIO (USUARIO_ID) ENABLE
	)';
	
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate 'CREATE SEQUENCE MONITORAMENTO_CCF_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE';	
	
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE MONITORAMENTO_CRZ 
	(
		MONITORAMENTOCRZ_ID NUMBER(7,0) NOT NULL ,
		EMPRESA_ID NUMBER(7,0),
		UF_INSTALACAO NUMBER(7,0),
		FISCALIMPRESSORA_ID NUMBER(7,0),
		DATA_REDUCAOZ_FALTANTE DATE, 
		PUNTOVENTA_ID NUMBER(7,0),
		ULTIMO_USUARIO_ECF_ID NUMBER(7,0), 
		SEQUENCIA_CRZ_QUEBRADA NUMBER(7,0), 
		DATA_MONITORAMENTO DATE,
        DIAS_ALERTA_ABERTO DATE,
        REPROCESSADO NUMBER(1,0),
		ACTIVO NUMBER(1,0), 
		FECMODIF DATE, 
		USUARIOMODIF_ID NUMBER(7,0), 
	    CONSTRAINT MONITORAMENTO_CRZ_ID_PK PRIMARY KEY (MONITORAMENTOCRZ_ID) ENABLE ,
	    CONSTRAINT FK_MCRZ_PUNTOVENTA FOREIGN KEY (PUNTOVENTA_ID) REFERENCES PUNTO_VENTA (PUNTOVENTA_ID) ENABLE,
	    CONSTRAINT FK_MCRZ_USUARIO FOREIGN KEY (ULTIMO_USUARIO_ECF_ID) REFERENCES USUARIO (USUARIO_ID) ENABLE,
		CONSTRAINT FK_MCRZ_USUARIOMODIF FOREIGN KEY (USUARIOMODIF_ID) REFERENCES USUARIO (USUARIO_ID) ENABLE
	)';
	
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate 'CREATE SEQUENCE MONITORAMENTO_CRZ_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE';	
	
  exception when object_exists then null;
end;