Hello, I would like to know how to make a correct treatment of my triggers and procedures, using Commit and Rollback. it cost
Exception treatment with Commit and Rollback
- dr_gori
- Moderador

- Posts: 5027
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Like this?
Do you want to do RollBack if you give any errors during the execution of your procedure?
Do you want to do RollBack if you give any errors during the execution of your procedure?
-
marcelo_nunes
- Rank: Programador Júnior

- Posts: 17
- Joined: Mon, 08 Sep 2008 7:35 pm
- Location: Ribeirão Preto - SP
Marcelo Nunes
Analista/Desenvolvedor Oracle
Analista/Desenvolvedor Oracle
If you are using Pragma AutoNomous_Transaction in the trigger, you will have to treat insert to insert for if this process falls on the exception it does a rollback, with this you put the commit only at the end of the trigger.
But if you are not using Pragma AutoNomous_Transaction, the trigger itself will not let the information be "commitates" and will give a rollback in everything that was performed there because you can not put commit in trigger.
But if you are not using Pragma AutoNomous_Transaction, the trigger itself will not let the information be "commitates" and will give a rollback in everything that was performed there because you can not put commit in trigger.
- fsitja
- Rank: OraSauro

- Posts: 611
- Joined: Mon, 19 Jan 2009 4:29 pm
- Location: Gaúcho no Rio de Janeiro - RJ
"The scars exist to remind us that the past was real"
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html
OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist
Campanha: Como fazer uma pergunta e obter uma resposta.
http://tkyte.blogspot.com/2005/06/how-t ... tions.html
OCA & OCP Developer — OCE SQL Expert — OCS Data Warehousing Specialist
You do not need Autonomous Transaction in your case, since there is dependence between the two operations. Let the trigger give a raise on the exception on the 2nd insert normally. At the exit of your DML that fired the trigger, take the exception and give the rollback. Will cancel everything.
Now, very careful with Autonomous Transaction. The ideal is to treat everything in a transaction only and decide by the Commit or RollBack at the end, not to end up detonating with the consistency of the database.
Now, very careful with Autonomous Transaction. The ideal is to treat everything in a transaction only and decide by the Commit or RollBack at the end, not to end up detonating with the consistency of the database.
-
RodrigoValentim
- Moderador

- Posts: 367
- Joined: Tue, 25 Mar 2008 3:41 pm
- Location: Salvador - BA
Rodrigo Valentim
Analista de Sistemas
Oracle Developer
Campanha: Faça uma pesquisa antes de perguntar!!!
Analista de Sistemas
Oracle Developer
Campanha: Faça uma pesquisa antes de perguntar!!!
In trigger it is not these situations and yes in the application, why do not you test the situation before the process go to the bank?
Once the trigger action is made, there is no more rollback because of the Commit.
Once the trigger action is made, there is no more rollback because of the Commit.
-
- Information
-
Who is online
Users browsing this forum: Baidu [Spider] and 1 guest

