PROMPT Pokretanje datoteke vnn_poruke.sql

ALTER TRIGGER AR_S_PORUKE DISABLE;
ALTER TRIGGER AS_S_PORUKE DISABLE;
ALTER TRIGGER BS_S_PORUKE DISABLE;

ALTER TRIGGER AR_S_POR_JEZ DISABLE;
ALTER TRIGGER AS_S_POR_JEZ DISABLE;
ALTER TRIGGER BS_S_POR_JEZ DISABLE;

alter table S_POR_JEZ
  disable constraint PORJEZ_POR_FK;
  
alter table SMET_MOD_POR
  disable constraint METMODPOR_POR_FK;

-- x = MAX (id) na i3instal
DELETE FROM s_poruke WHERE id > 5828;

@v252_poruke_delete.sql
@v252_poruke_insert.sql
@v252_poruke_update.sql

DELETE S_POR_JEZ t
WHERE NOT EXISTS (SELECT NULL FROM s_poruke p WHERE t.sifra_metapl = p.sifra_metapl AND t.sifra_por = p.sifra);

DELETE SMET_MOD_POR t
where NOT EXISTS (SELECT NULL FROM s_poruke p WHERE t.sifra_metapl = p.sifra_metapl AND t.sifra_por = p.sifra);

COMMIT;

ALTER TRIGGER AR_S_PORUKE ENABLE;
ALTER TRIGGER AS_S_PORUKE ENABLE;
ALTER TRIGGER BS_S_PORUKE ENABLE;

ALTER TRIGGER AR_S_POR_JEZ ENABLE;
ALTER TRIGGER AS_S_POR_JEZ ENABLE;
ALTER TRIGGER BS_S_POR_JEZ ENABLE;

alter table S_POR_JEZ
  enable constraint PORJEZ_POR_FK;
  
alter table SMET_MOD_POR
  enable constraint METMODPOR_POR_FK;