Skip to Content
0
Former Member
Jun 10, 2016 at 05:44 PM

SQLErrText

208 Views

Hello,

How does one go about getting the Sql Error Text associated with the SQLCODE in a SQLAnywhere 16 stored procedure. I can't seem to find a variable like the PowerBuilder SQLErrText that would hold this text. For example, for SQLCODE = -195, the message text is "Column '%1' in table '%2' cannot be NULL" How do I get the full message with the parameters filled in in a stored procedure?

For Example:

EXCEPTION

WHEN OTHERS THEN

SET ls_sqlcode = String(SQLCODE);

ROLLBACK;

CALL notfy_notification('H', 'I', 'ERROR','Error in Procedure SQLCODE: ' || ls_sqlcode, null);

raiserror 18002 '18002 Error SQLCODE: ' || ls_sqlcode;

END;

Thanks