declare object_exists exception; except_02275 exception; pragma exception_init (object_exists , -01430); pragma exception_init (except_02275 , -02275); begin execute immediate 'ALTER TABLE PACOTE_TARIFA ADD CONSTRAINT FK_CATEGORIA FOREIGN KEY (CATEGORIA_ID) REFERENCES CATEGORIA (CATEGORIA_ID)'; exception when object_exists then null; when except_02275 then null; end;