Saturday, 26 November 2016

[firebird-support] Re: Catching errors and continue processing

 

Continued..  

Adding a SUSPEND call resolves the issue. Records calculated before as well as after the exception are now commited and the changed procedure below gets the job done.

/M



SET TERM ^ ;
ALTER PROCEDURE P_LN_PC_PLAN_ALL_INSTRUMENTS2
RETURNS (
    ID Varchar(20),
    RESULT Varchar(100) )
AS
BEGIN
  FOR SELECT ID 
  FROM LN_LOANS
  WHERE COALESCE(DETAILS_LOCKED, 0)=0
  INTO :ID
  DO BEGIN
      RESULT='SUCCESS';
      EXECUTE PROCEDURE P_LN_PC_PLANINSTRUMENT(:ID);
      SUSPEND;  
      WHEN ANY DO BEGIN
        IN AUTONOMOUS TRANSACTION DO
           INSERT INTO LN_PLAN_ERRORS (LOAN_ID, ERRORDATE, MSG)
           VALUES (:ID, CURRENT_TIMESTAMP, 'GDSCODE: '||GDSCODE||', SQLCODE: '||SQLCODE||', SQLSTATE: '||SQLSTATE);
        RESULT='FAILED';
        SUSPEND;
      END     
  END
END ^
SET TERM ; ^

__._,_.___

Posted by: martin_gbg_@hotmail.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Documentation item
on the main (top) menu.  Try FAQ and other links from the left-side menu there.

Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

.

__,_._,___

No comments:

Post a Comment