declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE DISPOSITIVO_EMBARCADA (
		DISPOSITIVOEMBARCADA_ID NUMBER(8),
		EMPRESA_ID NUMBER(7),
		PUNTOVENTA_ID NUMBER(7),
		DESCRICAO VARCHAR2(200),
		REGISTRO VARCHAR2(200),
		MAC VARCHAR2(20),
		IMEI VARCHAR2(200),
		IND_DISP_BLOQUEADO NUMBER(1) DEFAULT 0,
		MOTIVO_DISP_BLOQUEADO VARCHAR2(200),
		IND_DISP_MANUTENCAO NUMBER(1) DEFAULT 0,
		MOTIVO_DISP_MANUTENCAO VARCHAR2(200),
		IND_DISP_BAIXADO NUMBER(1) DEFAULT 0,
		MOTIVO_DISP_BAIXADO VARCHAR2(200),
		FECMODIF DATE,
		ACTIVO NUMBER(1),
		USUARIO_ID NUMBER(7),
		PRIMARY KEY (DISPOSITIVOEMBARCADA_ID)
	)';
	
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate 'CREATE SEQUENCE DISPOSITIVO_EMBARCADA_SEQ INCREMENT BY 1 START WITH 1';	
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate
	'CREATE TABLE DISPOSITIVO_EMBARCADA_HIST (
		DISPOSITIVO_EMBARCADA_HIST_ID NUMBER(12),
		DISPOSITIVOEMBARCADA_ID NUMBER(8),
		DESCRICAO VARCHAR2(500),
		FECMODIF DATE,
		ACTIVO NUMBER(1),
		USUARIO_ID NUMBER(7),
		PRIMARY KEY (DISPOSITIVO_EMBARCADA_HIST_ID)
	)';
	
  exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
  execute immediate 'CREATE SEQUENCE DISPOSITIVO_EMBARCADA_HIST_SEQ INCREMENT BY 1 START WITH 1';	
  exception when object_exists then null;
end;
