Categories
Mastering Development

Decrement oracle sequence when an exception occured

I try to insert a new record in my database using pl/sql, so first of all i generate a new sequence like so :

select my_seq.nextval into seqId from dual ;

And then i try to insert a new record using the generated seqId like this :

insert into myTable (id) values seqId ;

But when an error occured during the insertion i want to decrement my sequence in an exception bloc anyone has an idea please ?

Leave a Reply

Your email address will not be published. Required fields are marked *