Subject | RE: [firebird-support] SQLCODE -999 after catching FK exception |
---|---|
Author | Helen Borrie |
Post date | 2005-05-02T23:51:02Z |
At 04:09 PM 2/05/2005 -0400, you wrote:
handled by the WHEN ANY handler gave SQLCODE -999.
the other table (if that's what the EXECUTE PROCEDURE call does) will work
there, too, and you can pick up the RETURNING_VALUE for comparison with the
NEW.value.
exception that tells the client what went wrong. By all means, let the
handler log it to an external file first, but make sure that the exception
actually gets raised and prevents the insert from being written with
inconsistent data.
to write handlers inside triggers that swallow exceptions UNLESS the error
conditions are of mere academic interest.
./heLen
>OK. I'm used to Java, where only one handler would catch an exception.It's the same story with PSQL. You had two exceptions. The one that was
>What I'll do is add a local variable and use it to flag that the second
>exception block shouldn't do anything if the first block has executed
>and set the variable.
handled by the WHEN ANY handler gave SQLCODE -999.
>The update statement works, and there are no update triggers onThrough the New.variables - in a BEFORE trigger. The update statement on
>SXC_CLAIM.
>What is the proper way to link to the new inserted row?
the other table (if that's what the EXECUTE PROCEDURE call does) will work
there, too, and you can pick up the RETURNING_VALUE for comparison with the
NEW.value.
> >If you have to execute an operation on another table that will affectThen catch the exception when it is unsuccessful, and raise a custom
>any NEW.value
> >in the row being addressed by the trigger, perform this operation in a
>BEFORE trigger.
>
>I put it in an AFTER trigger, because I wanted to make sure the insert
>into SXC_CLAIM was successful.
exception that tells the client what went wrong. By all means, let the
handler log it to an external file first, but make sure that the exception
actually gets raised and prevents the insert from being written with
inconsistent data.
> >but don't make it swallow exceptions that ought to terminate theThen don't swallow the exceptions!! In fact, make it an absolute rule not
>operation in order to prevent an inconsistency.
>
>I'm very pedantic about that. In this case, all data that is valid must
>be loaded in to SXC_CLAIM, and any errors that occur during the trigger
>processing need human intervention.
to write handlers inside triggers that swallow exceptions UNLESS the error
conditions are of mere academic interest.
./heLen