1. Ramendra Singh
  2. PowerBuilder
  3. Tuesday, 7 December 2021 01:26 AM UTC

Hi All,

I have a Stored procedure in SQL Server 2019 which is using TRY CATCH for error handling instead of "RAISERROR" but this is not throwing a response back when SP is called from PowerBuilder using "Stored Procedure Update" functionality. 

If I use RAISERROR, it's working fine. 

I am using PB2019R3 and have used both "MSOLEDBSQL SQL Server driver" & "SNC SQL Native Client(OLE DB) driver".

Please let me know if there is any option to capture the response from TRY CATCH or if any further details needed.

Thanks

Ramendra

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 7 December 2021 02:37 AM UTC
  2. PowerBuilder
  3. # Permalink

Database error conditions are not categorized as runtime error exceptions, so you must use mechanisms such as RAISERROR to alert the app through the Transaction object's SQLCode, SQLDBCode and SQLErrText properties.

Comment
There are no comments made yet.
Matt Balent Accepted Answer Pending Moderation
  1. Wednesday, 8 December 2021 16:27 PM UTC
  2. PowerBuilder
  3. # 1

Are you using a THROW statement in your CATCH block?

 

Comment
  1. Ramendra Singh
  2. Thursday, 9 December 2021 23:21 PM UTC
Hi Matt, There was a custom function created to handle the error and what we noticed that it was just doing PRINT hence there was no response back to PB. We changed it to RAISERROR and it's working fine.



Initially I was under the impression that there is some issue with TRY CATCH but that was not the case.



thanks

Ramendra
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.