Skip to Content

Catch RAISEERROR from SQL Anywhere (Trigger) and display the Message in PowerBuilder

Nov 22, 2016 at 10:02 AM


avatar image
Former Member


I have the following statment in an Update/Insert-Trigger:

RAISERROR 18000, 'This is an error Message'

I can catch this error in the dberror-Event in u_dw/u_ds. Here I can also access the errrorcode (18000) via the sqldberror variable. But I don't have a access ont the errormessage ('This is an error Message') which I have defined during calling the RAISERROR in my trigger.

Is there an opportunity to get this message?


10 |10000 characters needed characters left characters exceeded

FWIW, it's called RAISERROR (just one E)...

I don't use PowerBuilder so I can't tell whether the error message text is available. However, you might use CREATE MESSAGE to store error code and error text in the catalog (in table SYSUSERMESSAGE) and query that based on the received error code...

Note, for that usage, the error code must be >= 20000.

* Please Login or Register to Answer, Follow or Comment.

1 Answer

Chris Keating
Dec 06, 2016 at 06:52 PM

This should work. When the raiserror is issues, PB should get the raiserror code back as the SQLDBCode event parameter and in the SQLErrText, an error like:

SQLState = S1000

[Sybase][ODBC Driver][SQL Anywhere]RAISERROR executed: This is an error Message

10 |10000 characters needed characters left characters exceeded