fixes bug#23833
dev:lucas qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@110091 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
6ef7797753
commit
b93052aea1
|
@ -0,0 +1,221 @@
|
|||
declare
|
||||
object_exists exception;
|
||||
pragma exception_init (object_exists , -00955);
|
||||
begin
|
||||
execute immediate
|
||||
'CREATE TABLE REVENUE
|
||||
(
|
||||
REVENUE_ID NUMBER(15) NOT NULL
|
||||
, CONSTRAINT REVENUE_PK PRIMARY KEY
|
||||
(
|
||||
REVENUE_ID
|
||||
)
|
||||
ENABLE
|
||||
, EMPRESA_ID NUMBER(7,0)
|
||||
, ORIGEN_ID NUMBER(7, 0)
|
||||
, DESTINO_ID NUMBER(7, 0)
|
||||
, RUTA_ID NUMBER(7, 0)
|
||||
, CLASESERVICIO_ID NUMBER(2, 0)
|
||||
, VIA_ID NUMBER(15,0)
|
||||
, FECHORVIAJE DATE
|
||||
, CATEGORIA_ID NUMBER(7, 0)
|
||||
, TIPOSERVICOBPE NUMBER(7,0)
|
||||
, PRECIOPRATICADO NUMBER(10, 2)
|
||||
, PRECIOREVENUE NUMBER(10, 2)
|
||||
, PRECIOREVENUECLIENTE NUMBER(10, 2)
|
||||
, REVENUEAPROVADO NUMBER(1, 0)
|
||||
, JUSTIFICATIVA_ID NUMBER(15, 0)
|
||||
, TIPOVENTA_ID NUMBER(2, 0)
|
||||
, ACTIVO NUMBER(1, 0)
|
||||
, FECMODIF DATE
|
||||
, USUARIO_ID NUMBER(7, 0)
|
||||
)';
|
||||
exception when object_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_EMP_FK FOREIGN KEY
|
||||
(
|
||||
EMPRESA_ID
|
||||
)
|
||||
REFERENCES EMPRESA
|
||||
(
|
||||
EMPRESA_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_ORIGEN_FK FOREIGN KEY
|
||||
(
|
||||
ORIGEN_ID
|
||||
)
|
||||
REFERENCES PARADA
|
||||
(
|
||||
PARADA_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_DESTINO_FK FOREIGN KEY
|
||||
(
|
||||
DESTINO_ID
|
||||
)
|
||||
REFERENCES PARADA
|
||||
(
|
||||
PARADA_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_CLASE_FK FOREIGN KEY
|
||||
(
|
||||
CLASESERVICIO_ID
|
||||
)
|
||||
REFERENCES CLASE_SERVICIO
|
||||
(
|
||||
CLASESERVICIO_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_CATEGORIA_FK FOREIGN KEY
|
||||
(
|
||||
CATEGORIA_ID
|
||||
)
|
||||
REFERENCES CATEGORIA
|
||||
(
|
||||
CATEGORIA_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_TIPOVENTA_FK FOREIGN KEY
|
||||
(
|
||||
TIPOVENTA_ID
|
||||
)
|
||||
REFERENCES TIPO_VENTA
|
||||
(
|
||||
TIPOVENTA_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
object_exists exception;
|
||||
pragma exception_init (object_exists , -00955);
|
||||
begin
|
||||
execute immediate
|
||||
'CREATE TABLE REVENUE_JUSTIFICATIVA
|
||||
(
|
||||
JUSTIFICATIVA_ID NUMBER(15) NOT NULL
|
||||
, CONSTRAINT JUSTIFICATIVA_PK PRIMARY KEY
|
||||
(
|
||||
JUSTIFICATIVA_ID
|
||||
)
|
||||
ENABLE
|
||||
, DESCJUSTIFICATIVA VARCHAR2(255 BYTE)
|
||||
, ACTIVO NUMBER(1, 0)
|
||||
, FECMODIF DATE
|
||||
, USUARIO_ID NUMBER(7, 0)
|
||||
)';
|
||||
exception when object_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
except_02275 exception;
|
||||
|
||||
pragma exception_init (column_exists , -01430);
|
||||
pragma exception_init (column_exists , -02275);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE REVENUE
|
||||
ADD CONSTRAINT REVENUE_JUSTIFICAIVA_FK FOREIGN KEY
|
||||
(
|
||||
JUSTIFICATIVA_ID
|
||||
)
|
||||
REFERENCES REVENUE_JUSTIFICATIVA
|
||||
(
|
||||
JUSTIFICATIVA_ID
|
||||
)
|
||||
ENABLE';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
column_exists exception;
|
||||
pragma exception_init (column_exists , -01430);
|
||||
begin
|
||||
execute immediate 'ALTER TABLE BOLETO ADD (INDREVENUE NUMBER(1) )';
|
||||
exception when column_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
object_exists exception;
|
||||
pragma exception_init (object_exists , -00955);
|
||||
begin
|
||||
execute immediate
|
||||
'CREATE SEQUENCE REVENUE_SEQ MINVALUE 1 MAXVALUE 9999999 INCREMENT BY 1';
|
||||
exception when object_exists then null;
|
||||
end;
|
||||
/
|
||||
declare
|
||||
object_exists exception;
|
||||
pragma exception_init (object_exists , -00955);
|
||||
begin
|
||||
execute immediate
|
||||
'CREATE SEQUENCE REVENUE_JUSTIFICAIVA_SEQ';
|
||||
exception when object_exists then null;
|
||||
end;
|
Loading…
Reference in New Issue