Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

raise_application_error and Write to Log

573450Jan 19 2010 — edited Jan 19 2010
Hi Gurus,

I have scenario where I want to raise_application_error and also write that information to a log table. I am inserting into the log table first then raising the application error. The problem is that it never appears to write to the log unless I remove the raise_application_error. I am probably handling the process incorreclty, but I am not sure what I should do to get it to work.

Any info would be greatly appreciated

DB Version: 10g

Note: This is handling exceptions that I encounter in a FORALL. I am using SAVE EXCEPTION.

Example:

EXCEPTION
WHEN update_inventory_error THEN Call custom Exception Handler
errors := SQL%BULK_EXCEPTIONS.COUNT; Count all of the Errors in the Bulk Collect
FOR i IN 1..errors LOOP

vErr := SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE);
vDescrip:= 'Error #' || i || ' occurred during '|| 'ProductID: ' || l_amazon_sku(i) || ' iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX;

Insert Into Feeds.FeedLog(ID,Feed,ErrorMessage,Description,ErrorDate)
Values(
Feeds.FeedLog_seq.nextval ID
,'Generate Inventory' FEED
,vErr ErrorMessage
,vDescrip Description
,SYSDATE);
END LOOP;
raise_application_error(-20101,'Generate Inventory Failed FORALL ISSUE');

Edited by: ScarpacciOne on Jan 19, 2010 3:37 PM

Edited by: ScarpacciOne on Jan 19, 2010 3:38 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2010
Added on Jan 19 2010
2 comments
1,221 views