declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE MD_DOCUMENTO (
		DOCUMENTO_ID NUMBER(12) NOT NULL,
		FECCORTE DATE,
		PUNTOVENTA_ID NUMBER(7),
		EMPRESA_ID NUMBER(7),
		CONTA_ID NUMBER(7),
		SERIE VARCHAR2(30),
		SUBSERIE VARCHAR2(30),
		NUMEROINICIAL NUMBER(9),
		NUMEROFINAL NUMBER(9),
        ACTIVO NUMBER(1),
        FECMODIF DATE,
        USUARIO_ID NUMBER(7),
        PRIMARY KEY (DOCUMENTO_ID)
	)';
	  
  execute immediate 
	'CREATE SEQUENCE MDDOCUMENTO_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE';	
	
  exception when object_exists then null;
end;
