Exception SQL Oracle - Update and Insert

Asked

Viewed 983 times

1

I have a question regarding a precedent that I am making oracle bank.
A small explanation for what I am doing: I am reading data from a table, and throwing them on a cursor, after playing on the cursor, I play it for a record, in the procedure I have 2 update and 10 Inserts, in different tables.

My question is this, in case any of these procedures go wrong, I give a rollback, in everything that’s ever been done. Is there any oracle Exception that I can handle, for update and Inserts and rollblack?

  • VIDE https://docs.oracle.com/cd/A97630_01/appdev.920/a96624/07_errs.htm

1 answer

4

Your question is not very clear. If you are wanting to treat a mistake, you need to know what kind of mistake it is.

For example:

begin
  insert into TABELA(id, coluna1) values (1, 'Valor1);
exception
  when DUP_VAL_ON_INDEX then 
    -- Aqui faço o tratamento se o registro já existia.
  when OTHERS then
    -- Qualquer outro erro vai cair aqui
end;

Try to study a little about exceptions treatment that is worthwhile.

Abs

Browser other questions tagged

You are not signed in. Login or sign up in order to post.