declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE LOG_AUDITORIA (
       LOGAUDITORIA_ID      NUMBER(15) NOT NULL,
       EMPRESA_ID           NUMBER(7) NULL,
       VALOR_ANTERIOR       VARCHAR2(100) NULL,
       USUARIO_ID           NUMBER(7) NULL,
       VALOR_NOVO           VARCHAR2(100) NULL,
       CAMPO_ALTERADO       VARCHAR2(100) NULL,
       CLASSE_ALTERADA      VARCHAR2(100) NULL,
       CLASSE_PRINCIPAL     VARCHAR2(100) NULL,
       TELA                 VARCHAR2(100) NULL,
       TIPO_ALTERACAO       VARCHAR2(20) NULL,
       ACTIVO               NUMBER(1) NULL,
       FECMODIF             DATE NULL,
       PRIMARY KEY (LOGAUDITORIA_ID), 
       FOREIGN KEY (USUARIO_ID) REFERENCES USUARIO, 
       FOREIGN KEY (EMPRESA_ID) REFERENCES EMPRESA
	)';
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate 
	'CREATE SEQUENCE LOG_AUDITORIA_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE';	
  exception when object_exists then null;
end;
