declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE FOLIO_CONSUMO_RMD 
	(
		FOLIOCONSUMORMD_ID NUMBER(7,0) NOT NULL ENABLE,
		RMD_ID NUMBER(7,0),
		FOLIO VARCHAR2(20 BYTE), 
		EMPRESA_ID NUMBER(7,0),
		ESTADO_ID NUMBER(7,0), 
		INDCANCELACION NUMBER(1,0), 
		INDINACTIVO NUMBER(1,0),
        FECHORFOLIO DATE, 
		INDECF NUMBER(1,0),
		INDBPR NUMBER(1,0),
		ACTIVO NUMBER(1,0), 
		FECMODIF DATE, 
		USUARIO_ID NUMBER(7,0), 
	    CONSTRAINT FOLIO_CONSUMO_RMD_PK PRIMARY KEY (FOLIOCONSUMORMD_ID) ENABLE ,
	    CONSTRAINT FK_RMD_EMPRESA FOREIGN KEY (EMPRESA_ID) REFERENCES EMPRESA (EMPRESA_ID) ENABLE,
	    CONSTRAINT FK_RMD_AIDF FOREIGN KEY (RMD_ID) REFERENCES AIDF (AIDF_ID) ENABLE,
	    CONSTRAINT FK_RMD_ESTADO FOREIGN KEY (ESTADO_ID) REFERENCES ESTADO (ESTADO_ID) ENABLE
	)';
	  
  execute immediate 'CREATE SEQUENCE FOLIO_CONSUMO_RMD_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE';	
	
  exception when object_exists then null;
end;