SQL Exception Oracle - Update and Insert

1

I have a question regarding a procedure that I'm doing oracle database. A little explanation for what I'm doing: I'm reading data from a table, and playing them on a cursor, after playing the cursor, I set it to a record, in the procedure I have 2 update and 10 inserts, in different tables. / p>

My question is the following, in case any of these procedures do something wrong, I give a rollback, in everything that has already been done. Is there any exception to oracle that I can handle this, for the updates and inserts and rollblack?

    
asked by anonymous 02.12.2016 / 15:17

1 answer

4

Your question is not very clear. If you are wanting to handle an error, you need to know what type of error 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 worthwhile exceptions treatment.

Abs

    
02.12.2016 / 18:19