Subject Re: [ib-support] Creating exceptions to handle CHECK constraints
Author Helen Borrie
At 08:02 AM 21/04/2003 +0930, you wrote:
>When a certain table is updated, it triggers a cascade of updates in
>other tables, many of whose fields might not satisfy their CHECK
>constraints.
>
>How is one to distinguish between these so that the user can be
>presented with meaningful information?
>
>E.g. Field "Amount Remaining" in Table "Feed Inventory" has become
>negative.

You can create exceptions and use these in your triggers to return a
"meaningful" message to the client. For example,

create exception balance_negative ' "Amount Remaining" in Table "Feed
Inventory" has become
negative.'

(I haven't done a character count on this but the message string does have
a pretty short limit, I think about 70 characters...an incentive for
writing tight messages :-) ))

Helen