AdmMono/src/db/migration/V20180305_0925__mantis10642...

27 lines
945 B
SQL

declare
object_exists exception;
pragma exception_init (object_exists , -00942);
begin
execute immediate 'delete from PRECIO_FIXO_PEDAGIO where PRACAPEDAGIO_ID not in (select CASETAPEAJE_ID from caseta_peaje)';
exception when object_exists then null;
end;
/
declare
object_exists exception;
except_02275 exception;
except_02270 exception;
except_02261 exception;
pragma exception_init (object_exists , -01430);
pragma exception_init (except_02275 , -02275);
pragma exception_init (except_02270 , -02270);
pragma exception_init (except_02261 , -02261);
begin
execute immediate 'alter table PRECIO_FIXO_PEDAGIO add constraint PRACAPEDGAIO_CASETA foreign key("PRACAPEDAGIO_ID") references "CASETA_PEAJE"("CASETAPEAJE_ID")';
exception
when object_exists then null;
when except_02275 then null;
when except_02270 then null;
when except_02261 then null;
end;