Advertisement

10.21.2005 at 12:42PM PDT, ID: 21603575
[x]
Attachment Details

Question regarding trigers, autonomous transacs and errors

Asked by sinner in Oracle Database

Tags: trigers

Hello,
I had the tipical error of having an execute immediate within a trigger which was not autonomous.
So I packed up the triger code, placed in a procedure and made it Autonomous (triger could have been autonomus but it gave me an excuse to clean up the code).
This fixed the problem and everyone is happy... sort of.

The problem that I now have, is that I have no clue if the "execute immediate" command was succesful or not.

The triger that I have alters a table, it will create a column on insert.
But if the alter table fails for some reason, I need the insert command to fail. So that the user knows that the column was not created.

I thought about doing a select from USER_TAB_COLUMNS after calling the autonomous procedure, but this gives me no guarantee that it failed/succeded, if the server is busy, maybe the command is "on queue". Is this a correct asumption?

What would be a "proper" way of solving this?

Thanks. Start Free Trial
[+][-]10.21.2005 at 01:07PM PDT, ID: 15135235

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Oracle Database
Tags: trigers
Sign Up Now!
Solution Provided By: DrSQL
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.21.2005 at 01:15PM PDT, ID: 15135296

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.21.2005 at 01:16PM PDT, ID: 15135303

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.21.2005 at 08:52PM PDT, ID: 15136996

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32