73 lines
2.7 KiB
SQL
73 lines
2.7 KiB
SQL
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate
|
|
'CREATE TABLE OPERADOR_EMBARCADA (
|
|
OPERADOR_EMBARCADA_ID NUMBER(10,0),
|
|
USUARIO_ID NUMBER(7,0),
|
|
FECMODIF DATE NULL,
|
|
ACTIVO NUMBER(1,0) DEFAULT 0,
|
|
PRIMARY KEY (OPERADOR_EMBARCADA_ID) ENABLE,
|
|
CONSTRAINT OPERADOR_EMBARCADA_USUARIO_FK FOREIGN KEY (USUARIO_ID) REFERENCES USUARIO(USUARIO_ID) ENABLE
|
|
)';
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate 'CREATE SEQUENCE OPERADOR_EMBARCADA_SEQ INCREMENT BY 1 START WITH 1 MAXVALUE 9999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER';
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate
|
|
'CREATE TABLE OPERADOR_EMBARCADA_LINHA (
|
|
OPERADOR_EMBARCADA_LINHA_ID NUMBER(10,0),
|
|
OPERADOR_EMBARCADA_ID NUMBER(10,0),
|
|
RUTA_ID NUMBER(7,0) NOT NULL,
|
|
ACTIVO NUMBER(1,0) DEFAULT 0,
|
|
PRIMARY KEY (OPERADOR_EMBARCADA_LINHA_ID) ENABLE,
|
|
CONSTRAINT OPERADOR_EMBARCADA_FK FOREIGN KEY (OPERADOR_EMBARCADA_ID) REFERENCES OPERADOR_EMBARCADA(OPERADOR_EMBARCADA_ID) ENABLE,
|
|
CONSTRAINT OPERADOR_EMBARCADA_RUTA_FK FOREIGN KEY (RUTA_ID) REFERENCES RUTA(RUTA_ID) ENABLE
|
|
)';
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate 'CREATE SEQUENCE OPERADOR_EMBARCADA_LINHA_SEQ INCREMENT BY 1 START WITH 1 MAXVALUE 9999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER';
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate
|
|
'CREATE TABLE OPERADOR_EMBARCADA_SERVICO (
|
|
OPERADOR_EMBARCADA_SERVICO_ID NUMBER(10,0),
|
|
OPERADOR_EMBARCADA_ID NUMBER(10,0),
|
|
ESQUEMA_CORRIDA_ID NUMBER(7,0) NOT NULL,
|
|
ACTIVO NUMBER(1,0) DEFAULT 0,
|
|
PRIMARY KEY (OPERADOR_EMBARCADA_SERVICO_ID) ENABLE,
|
|
CONSTRAINT OPERADOR_EMBARCADA_SERVICO_FK FOREIGN KEY (OPERADOR_EMBARCADA_ID) REFERENCES OPERADOR_EMBARCADA(OPERADOR_EMBARCADA_ID) ENABLE,
|
|
CONSTRAINT OPERADOR_ESQUEMA_SERVICO_FK FOREIGN KEY (ESQUEMA_CORRIDA_ID) REFERENCES ESQUEMA_CORRIDA(ESQUEMACORRIDA_ID) ENABLE
|
|
)';
|
|
exception when object_exists then null;
|
|
end;
|
|
/
|
|
declare
|
|
object_exists exception;
|
|
pragma exception_init (object_exists , -00955);
|
|
begin
|
|
execute immediate 'CREATE SEQUENCE OPERADOR_EMBARCADA_SERVICO_SEQ INCREMENT BY 1 START WITH 1 MAXVALUE 9999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER';
|
|
exception when object_exists then null;
|
|
end; |