Re: Error Handling Coming Out of a Trigger




I have an after update trigger on a table. This trigger is used to help
enforce a business rule of not allowing a zero quantity.

I have the following code in the body of the trigger. I had expected that it
would have caused an exception in the calling application; because i am
using the RAISERROR statement. I also tried several different severity
levels but none worked for me. I get nothing back at all, no message and
certainly no exception.

-- Note this check below will allow for a "zero cost item" to be saved to
the

-- database. It will not however let the Quantity of any SL to be

-- zero or less.

If (@Qty IS NULL) OR (@Qty < 1) OR (@UC IS NULL) or (@UC < 0)

or (@Allowed IS NULL) OR (@Allowed < 0)

BEGIN

ROLLBACK TRANSACTION

SET @ErrMsg = 'The Service Line is not sufficiently setup to ' +

'effectively manage the GL system. The Quantity, Fee, and ' +

'Allowed values must be set prior to attempting to save. ' +

'Review these values and try again.'

RAISERROR(@ErrMsg, 16, 1);

RETURN
Try raising the severity up to 19 or
examine the TadoConnection.Errors collection to look for errors that are not
critical enough to trigger an exception


--
Brian Bushay (TeamB)
Bbushay@xxxxxxxxx
.



Relevant Pages

  • Error Handling Coming Out of a Trigger
    ... I have an after update trigger on a table. ... enforce a business rule of not allowing a zero quantity. ... would have caused an exception in the calling application; ... FErrorMessage:= ...
    (borland.public.delphi.database.ado)
  • "on exception" statement not firing within stored procedure when called from trigger
    ... I am experiencing a problem whereby ON EXCEPTION statements are ... not firing within stored procedures when the stored procedures ... are invoked from a trigger. ... create table tBar ) lock mode row; ...
    (comp.databases.informix)
  • Re: Error Handling Coming Out of a Trigger
    ... http://www.oledbdirect.com - The fastest way to access MS SQL Server, ... I have an after update trigger on a table. ... would have caused an exception in the calling application; ... FErrorMessage:= ...
    (borland.public.delphi.database.ado)
  • Re: [RFC] hwbkpt: Hardware breakpoints (was Kwatch)
    ... meaning that neither notifier will return NOTIFY_STOP. ... If it's a ptrace exception it also ... as a special case for a ptrace trigger. ...
    (Linux-Kernel)
  • Re: "record not found or changed by another user"
    ... > Sporadically we will get an exception in ApplyUpdates: ... So a trigger that attempts an insert/update but doesn't, ... INSERT INTO ChangeHistory ...
    (borland.public.delphi.database.ado)