Re: raise_application_error and when others

  • From: "Tim Gorman" <tim@xxxxxxxxx>
  • To: "Chuck Boddy" <Chuck.Boddy@xxxxxxxxxxxxxxx>, oracle-l@xxxxxxxxxxxxx
  • Date: Wed, 30 Nov 2011 21:39:50 +0000

Check your syntax for RAISE_APPLICATION_ERROR, your parameters are probably 
reversed. Typical call to RAISE_APPLICATION_ERROR runs something like...
 raise_application_error(-20400, 'I tawt I taw a putty tat!');

instead of...

 raise_application_error('I tawt I taw a putty tat!', -20400);

Hope this helps...


-----Original Message-----
From: Chuck Boddy [mailto:Chuck.Boddy@xxxxxxxxxxxxxxx]
Sent: Wednesday, November 30, 2011 02:33 PM
To: tim@xxxxxxxxx, oracle-l@xxxxxxxxxxxxx
Subject: RE: raise_application_error and when others

That?s what I initially thought too. So I checked the calling procedure, and 
what is logged to the error table is specific to the calling procedure. What is 
logged to the error table in this case, is only specific to that trigger(it 
writes the object name(the trigger) at the time the exception is hit.

This does seem to be handled differently than what I would expect?

raise_application_error(?sqlerrm populated?,?sqlcode populateted?);(user 
defined)

drops down to When others exeception with user defined sqlerrm and sqlcode.

Am I right to expect that when others SHOULD NOT be hit?

Thanks,
Chuck

From: Tim Gorman [mailto:tim@xxxxxxxxx]
Sent: Wednesday, November 30, 2011 1:19 PM
To: Chuck Boddy; oracle-l@xxxxxxxxxxxxx
Subject: Re: raise_application_error and when others


It's probable that the trigger is raising the ORA-20400 exception as specified, 
and is working just fine, but then the *calling* procedure or code is handling 
the returned exception from the trigger to log to the error table.


-----Original Message-----
From: Chuck Boddy [mailto:Chuck.Boddy@xxxxxxxxxxxxxxx]
Sent: Wednesday, November 30, 2011 02:11 PM
To: oracle-l@xxxxxxxxxxxxx
Subject: raise_application_error and when others

Hi, I have a trigger that under a condition, I call raise_application_error. I 
also have when others defined to write to an error table passing sqlerrm and 
sqlcode. My understanding is that when the condition is met and 
raise_application_error is called, execution ends in the subprogram. What 
"appears" to be happening, is that raise_application_error is handled THEN 
drops down to when others. Because the record that is written to my error table 
has the sqlerrm and sqlcode that is only populated in my user-defined 
raise_application_error handler(-20400). Is this true, that if you call 
raise_application_error AND have when others defined, the call to 
raise_application_error will then drop down to your when others exception? 
Thanks, Chuck -- //www.freelists.org/webpage/oracle-l



--
//www.freelists.org/webpage/oracle-l


Other related posts: