Skip to content Skip to sidebar Skip to footer

How To Continue Executing Rest Of While Loop Even If An Exception Occurs In Sybase?

This is related to this question but slightly different, I have while loop that inserts records and I want it to continue even if some inserts fail. So, the insertrecords procedure

Solution 1:

Try putting the content inside your while block inside try cactch.

NOTE:The below sample is in SQL, try similar code in sybase.

`WHILE(SOME CONDITION)

 BEGIN --start ofwhile block

    BEGIN TRY-start oftry block

      --your code here

    ENDTRY

     BEGIN CATCH

       PRINT ERR_MESSAGE();

       ENDCATCHEND --endofwhileloop.
 `

Post a Comment for "How To Continue Executing Rest Of While Loop Even If An Exception Occurs In Sybase?"