Chapter 3 DBMS Reference Guide
Handles errors during trigger generation using user-defined messages.
When you select User-defined in the Error Messages tab of the Rebuild Triggers dialog box, the .ERROR macro will be replaced by the content of the UseErrorMsgTable
entry during the rebuild process.
The .ERROR macro, is called by a template item in the trigger template, it has two parameters: %ERRNO% is the error number and %ERRMSG% is the standard error message.
User-Defined messages are stored in a message table which you have to create in your database:
Table variable | Description |
---|---|
%MSGTAB% | Table name |
%MSGNO% | Message number column that stores the error message number that is referenced in the trigger script |
%MSGTXT% | Message text column that stores the text of the message |
With the User-defined error messages option selected, if an error number in the trigger script corresponds to an error number in the message table, the error message default parameter of the .ERROR macro is replaced by the user-defined message from the message table.
In Sybase Adaptive Server Enterprise 12:
begin select @errno = %ERRNO%, @errmsg = %MSGTXT% from %MSGTAB% where %MSGNO% = %ERRNO% goto error end
%MSGTAB%, %MSGNO%
and %MSGTXT%
will be replaced by the values defined in the message number column, message text column, and message table name of the message table.
Copyright (C) 2005. Sybase Inc. All rights reserved. |