declare
    object_exists exception;
    pragma exception_init (object_exists , -00955);
begin
	execute immediate 

   'CREATE TABLE "DIGITA_ITEM" 
   (	"DIGITAITEM_ID" NUMBER(3,0) NOT NULL ENABLE, 
	"DIGITAVENTA_ID" NUMBER(7,0) NOT NULL ENABLE, 
	"FORMAPAGO_ID" NUMBER(7,0), 
	"CORRIDA_ID" NUMBER NOT NULL ENABLE, 
	"FECCORRIDA" DATE NOT NULL ENABLE, 
	"FECHORVIAJE" DATE NOT NULL ENABLE, 
	"TIPOVENTA_ID" NUMBER(7,0), 
	"CANTPASAJE" NUMBER(3,0), 
	"SERIE" VARCHAR2(30 BYTE), 
	"SUBSERIE" VARCHAR2(30 BYTE), 
	"NUMINICIAL" NUMBER(7,0), 
	"PRECIO" NUMBER(7,2), 
	"DESCUENTO" NUMBER(7,2), 
	"IMPORTETAXAEMBARQUE" NUMBER(7,2), 
	"IMPORTEPEDAGIO" NUMBER(7,2), 
	"IMPORTEOUTROS" NUMBER(7,2), 
	"IMPORTESEGURO" NUMBER(7,2), 
	"CATEGORIA_ID" NUMBER(7,0), 
	 CONSTRAINT "ITEMVENDA_PK" PRIMARY KEY ("DIGITAITEM_ID", "DIGITAVENTA_ID")
  USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS 
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  TABLESPACE "USERS"  ENABLE, 
	 CONSTRAINT "ITEMVENDA_CATEGORIA_FK" FOREIGN KEY ("CATEGORIA_ID")
	  REFERENCES "CATEGORIA" ("CATEGORIA_ID") ENABLE, 
	 CONSTRAINT "ITEMVENDA_CORRIDA_FK" FOREIGN KEY ("CORRIDA_ID", "FECCORRIDA")
	  REFERENCES "CORRIDA" ("CORRIDA_ID", "FECCORRIDA") ENABLE, 
	 CONSTRAINT "ITEMVENDA_VENDA_FK" FOREIGN KEY ("DIGITAVENTA_ID")
	  REFERENCES "DIGITA_VENTA" ("DIGITAVENTA_ID") ENABLE, 
	 CONSTRAINT "DIGITA_ITEM_TIPO_VENTA_FK" FOREIGN KEY ("TIPOVENTA_ID")
	  REFERENCES "TIPO_VENTA" ("TIPOVENTA_ID") ENABLE, 
	 CONSTRAINT "ITEMVENDA_FORMAPAGAMENTO_FK" FOREIGN KEY ("FORMAPAGO_ID")
	  REFERENCES "FORMA_PAGO" ("FORMAPAGO_ID") ENABLE
   )';
exception when object_exists then null;
end;

