declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE LOG_HISTORICO_CONTINGENCIA (
		LOGHISTORICOCONTINGENCIA_ID NUMBER(10,0),
		MOTIVO VARCHAR2(300 BYTE),
        USUARIO_ID NUMBER(7,0),
		DATAHORA DATE NULL,
		EMPRESA_ID NUMBER(7,0),
		ESTADO_ID NUMBER(7,0),
		STATUS VARCHAR2(20 BYTE),		
		PRIMARY KEY (LOGHISTORICOCONTINGENCIA_ID) ENABLE,
		CONSTRAINT LOGHISTORICOCONTINGENCIA_ID_USUARIO_FK FOREIGN KEY (USUARIO_ID) REFERENCES USUARIO(USUARIO_ID) ENABLE,
		CONSTRAINT LOGHISTORICOCONTINGENCIA_ID_EMPRESA_FK FOREIGN KEY (EMPRESA_ID) REFERENCES EMPRESA(EMPRESA_ID) ENABLE,
		CONSTRAINT LOGHISTORICOCONTINGENCIA_ID_ESTADO_FK FOREIGN KEY (ESTADO_ID) REFERENCES ESTADO(ESTADO_ID) ENABLE 
	)';
 exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate 'CREATE SEQUENCE LOG_HISTORICO_CONTINGENCIA_SEQ INCREMENT BY 1 START WITH 1 MAXVALUE 9999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER';	
  exception when object_exists then null;
end;