bug#11650

dev:Lucas
qua:Wallysson

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/BD/FlyWay/trunk@84140 d1611594-4594-4d17-8e1d-87c2c4800839
master
frederico 2018-08-10 18:12:43 +00:00
parent 3ac44d9049
commit 95468a63e7
1 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,43 @@
declare
begin
execute immediate 'CREATE TABLE PRICING_ESPECIFICO_CATEGORIA(
PRICINGESPECIFICO_CATEGORIAID NUMBER(7,0),
PRICINGESPECIFICO_ID NUMBER (7,0),
CATEGORIA_ID NUMBER (7,0),
FECMODIF DATE,
USUARIO_ID NUMBER (7,0),
ACTIVO NUMBER (1,0),
CONSTRAINT PRICINGESPECIFICOCATEGORIA_PK PRIMARY KEY (PRICINGESPECIFICO_CATEGORIAID)
)';
exception when others then null;
end;
/
declare
begin
execute immediate 'ALTER TABLE PRICING_ESPECIFICO_CATEGORIA
ADD CONSTRAINT PRICING_ESP_CAT_PRICING_ESP_FK FOREIGN KEY(PRICINGESPECIFICO_ID) REFERENCES PRICING_ESPECIFICO (PRICINGESPECIFICO_ID)';
exception when others then null;
end;
/
declare
begin
execute immediate 'ALTER TABLE PRICING_ESPECIFICO_CATEGORIA
ADD CONSTRAINT PRICING_ESP_CAT_PRICING_CAT_FK FOREIGN KEY(CATEGORIA_ID) REFERENCES CATEGORIA (CATEGORIA_ID)';
exception when others then null;
end;
/
declare
begin
execute immediate 'CREATE SEQUENCE PRICING_ESP_CATEGORIA_SEQ START WITH 1 INCREMENT BY 1';
exception when others then null;
end;
/
declare
begin
FOR R in(SELECT PE.PRICINGESPECIFICO_ID, PE.CATEGORIA_ID FROM PRICING_ESPECIFICO PE)
loop
INSERT INTO PRICING_ESPECIFICO_CATEGORIA VALUES(PRICING_ESP_CATEGORIA_SEQ.nextVal, R.PRICINGESPECIFICO_ID, R.CATEGORIA_ID, current_date, 1, 1);
end loop;
exception when others then null;
end;