--------------------------------------------TAXPOL-------------------------------------------------------------
--------------------------------------------------------
--  DDL for Table TAXPOL
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -00942);
begin
	execute immediate 'DROP TABLE "TAXPOL" cascade constraints';
    exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
  'CREATE TABLE "VTABOL"."TAXPOL" 
   ("TAXPOL_ID" NUMBER(7,0), 
	"EMPRESA_ID" NUMBER(7,0), 
	"CATEGORIA_ID" NUMBER(7,0), 
	"LOCALIDADE_ID" NUMBER(7,0), 
	"KM" NUMBER(7,0), 
	"ORGAOCONCEDENTE_ID" NUMBER(7,0), 
	"TIPO_TARIFA" VARCHAR2(15 BYTE), 
	"NUMTAXA" VARCHAR2(20 BYTE), 
	"DATAINSERCAO" DATE, 
	"ACTIVO" NUMBER(1,0), 
	"FECMODIF" DATE, 
	"USUARIO_ID" NUMBER(7,0), 
	"TAXPOLC_ID" NUMBER(7,0)
   )';
	    exception when object_exists then null;
end;
--------------------------------------------------------
--  DDL for Index IDX_TAXPOL
--------------------------------------------------------
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -01408);
begin
	execute immediate
 'CREATE UNIQUE INDEX "IDX_TAXPOL" ON "VTABOL"."TAXPOL" ("TAXPOL_ID")';
	    exception when object_exists then null;
end;
--------------------------------------------------------
--  Constraints for Table TAXPOL
--------------------------------------------------------
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
  'ALTER TABLE "TAXPOL" ADD CONSTRAINT "IDX_TAXPOL" PRIMARY KEY ("TAXPOL_ID")';
	    exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
  'ALTER TABLE "TAXPOL" MODIFY ("TAXPOL_ID" NOT NULL ENABLE)';
	    exception when object_exists then null;
end;
/
--------------------------------------------TAXPOLC-------------------------------------------------------------

--------------------------------------------------------
--  DDL for Table TAXPOLC
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -00942);
begin
	execute immediate 'DROP TABLE "TAXPOLC" cascade constraints';
    exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
  'CREATE TABLE "TAXPOLC" 
   (	"TAXPOLC_ID" NUMBER(7,0), 
	"EMPRESA_ID" NUMBER(7,0), 
	"CATEGORIA_ID" NUMBER(7,0), 
	"LOCALIDADE_ID" NUMBER(7,0), 
	"KM" NUMBER(7,0), 
	"CONCESSIONARIA" VARCHAR2(6 BYTE), 
	"TERMINAL" VARCHAR2(15 BYTE), 
	"ORGAOCONCEDENTE_ID" NUMBER(7,0), 
	"TIPO_TARIFA" VARCHAR2(15 BYTE), 
	"TX_ABREVIADA" VARCHAR2(20 BYTE), 
	"ACTIVO" NUMBER(1,0), 
	"FECMODIF" DATE, 
	"USUARIO_ID" NUMBER(7,0)
   )';
   	    exception when object_exists then null;
end;
/
   --------------------------------------------------------
--  DDL for Index IDX_TAXPOLC
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -01408);
begin
	execute immediate
  'CREATE UNIQUE INDEX "IDX_TAXPOLC" ON "TAXPOLC" ("TAXPOLC_ID")';
	    exception when object_exists then null;
end;
/
--------------------------------------------------------
--  Constraints for Table TAXPOL
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
  'ALTER TABLE "TAXPOLC" ADD CONSTRAINT "IDX_TAXPOLC" PRIMARY KEY ("TAXPOLC_ID")';
 	    exception when object_exists then null;
end;
/
--------------------------------------------TAXPOV-------------------------------------------------------------
--------------------------------------------------------
--  DDL for Table TAXPOLV
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -00942);
begin
	execute immediate 'DROP TABLE "TAXPOLV" cascade constraints';
    exception when object_exists then null;
end;
/
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
'CREATE TABLE "VTABOL"."TAXPOLV" 
   (	"TAXPOLV_ID" NUMBER(10,0), 
	"BOLETO_ID" NUMBER(16,0), 
	"CORRIDA_ID" NUMBER(9,2), 
	"DATAVIAGEM" VARCHAR2(8 BYTE), 
	"ORIGEN_ID" NUMBER(7,0), 
	"DESTINO_ID" NUMBER(7,0), 
	"POLTRONA" VARCHAR2(2 BYTE), 
	"FOLIO_SISTEMA" VARCHAR2(15 BYTE), 
	"EMPRESA_ID" NUMBER(7,0), 
	"CATEGORIA_ID" NUMBER(7,0), 
	"NUMTAXA" VARCHAR2(15 BYTE), 
	"DATAINSERCAO" VARCHAR2(8 BYTE), 
	"CONCESSIONARIA" VARCHAR2(6 BYTE), 
	"TERMINAL" VARCHAR2(6 BYTE), 
	"VALORTAXA" NUMBER(8,2), 
	"TIPO_TARIFA" VARCHAR2(15 BYTE), 
	"TXABREVIADA" VARCHAR2(20 BYTE), 
	"ORGAOCONCEDENTE" NUMBER(7,0), 
	"HORASAIDA" VARCHAR2(5 BYTE), 
	"RUTA_ID" NUMBER(7,0), 
	"DATAVENDA" VARCHAR2(8 BYTE), 
	"HORAVENDA" VARCHAR2(5 BYTE), 
	"USUARIO_ID" NUMBER(7,0), 
	"INDCANCELADO" NUMBER(1,0), 
	"USUARIOCANC" NUMBER(7,0), 
	"SESSAOCANCELAMENTO" VARCHAR2(6 BYTE), 
	"DATACANCELAMENTO" VARCHAR2(8 BYTE), 
	"ACTIVO" NUMBER(1,0)
   )';
    	    exception when object_exists then null;
end;
/
--------------------------------------------------------
--  DDL for Index IDX_TAXPOLV
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -01408);
begin
	execute immediate
  'CREATE UNIQUE INDEX "IDX_TAXPOLV" ON "TAXPOLV" ("TAXPOLV_ID")';
 	    exception when object_exists then null;
end;
/
--------------------------------------------------------
--  Constraints for Table TAXPOLV
--------------------------------------------------------
declare
    object_exists exception;
    pragma exception_init (object_exists , -01430);
begin
	execute immediate
 'ALTER TABLE "TAXPOLV" ADD CONSTRAINT "IDX_TAXPOLV" PRIMARY KEY ("TAXPOLV_ID")';
  	    exception when object_exists then null;
end;


