UPS.SQL 1.45 KB
Newer Older
willgonzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
ALTER SESSION SET NLS_DATE_FORMAT = 'dd-mm-yyyy';
CREATE TABLE CENTRO_UPS(
	ID INTEGER NOT NULL,
	TIPO VARCHAR(50),
	DIRECCION VARCHAR(50) NOT NULL,
	CONSTRAINT PK_ID PRIMARY KEY(ID)
);

CREATE SEQUENCE SEQUENCE_ID
	START WITH 1
	INCREMENT BY 1;


CREATE TABLE ARTICULOS(
	NRO_ARTICULOS INTEGER NOT NULL,
	ID_CENTRO INTEGER,
	PESO FLOAT NOT NULL, 
	DIMENSION VARCHAR(10) NOT NULL,
	IMPORTE INTEGER NOT NULL,
	FECHA_FINAL DATE NOT NULL,
	DESTINO VARCHAR(50) NOT NULL, 
	CONSTRAINT PK_NRO_ARTICULOS PRIMARY KEY(NRO_ARTICULOS),
	CONSTRAINT FK_ID_CENTRO FOREIGN KEY(ID_CENTRO) REFERENCES CENTRO_UPS(ID)
);

CREATE SEQUENCE SEQUENCE_NRO_ARTICULOS
	START WITH 1
	INCREMENT BY 1;

CREATE TABLE TRANSPORTE(
	N_EVENTO INTEGER NOT NULL,
	TIPO VARCHAR(20) NOT NULL,
	RUTA VARCHAR(30) NOT NULL,
	DIRECCION VARCHAR(30) NOT NULL,
	CONSTRAINT PK_N_EVENTO PRIMARY KEY(N_EVENTO)	
);
CREATE SEQUENCE SEQUENCE_N_EVENTO
	START WITH 1
	INCREMENT BY 1;

INSERT INTO CENTRO_UPS(ID,TIPO,DIRECCION)
VALUES(SEQUENCE_ID.NEXVAL,"CENTRO DE EMBALAJE","MARIANO ROQUE ALONSO");

INSERT INTO ARTICULOS(NRO_ARTICULOS,PESO,DIMENSION,IMPORTE,FECHA_FINAL,DESTINO)
VALUES(SEQUENCE_NRO_ARTICULOS.NEXVAL,8.3,"10X10CM",50000,'19/10/2021');

INSERT INTO ARTICULOS(NRO_ARTICULOS,PESO,DIMENSION,IMPORTE,FECHA_FINAL,DESTINO)
VALUES(SEQUENCE_NRO_ARTICULOS.NEXVAL,7.4,"5X10CM",80000,'28/10/2021');

INSERT INTO TRANSPORTE(N_EVENTO,TIPO,RUTA,DIRECCION)
VALUES(SEQUENCE_N_EVENTO.NEXVAL,"AUTOMOVIL","TRANSCHACO","MARIANO ROQUE ALONSO");