declare object_exists exception; pragma exception_init (object_exists , -00955); begin execute immediate 'ALTER TABLE PACOTE_FORMAPAGO ADD CONSTRAINT FK_PACOTE_FORMAPAGO_NC FOREIGN KEY (NOTACREDITOVENDAPACOTE_ID) REFERENCES NOTA_CREDITO_VENDA_PACOTE (NOTACREDITOVENDAPACOTE_ID)'; exception when object_exists then null; end;