Subject Re: [firebird-support] Re: Debugging cascaded updates
Author Helen Borrie
At 03:16 AM 8/11/2004 +0000, you wrote:


>OK, let me clear this up, because both responses seem to have missed
>what I was trying to say.
>
>There is no problem with Firebird per se. I am not concerned about the
>error, it is an invalid typecast style message, I am probably trying
>to insert a string into an integer field.
>
>When I delete the parent record, there are about 30 triggers that fire
>off. One of those triggers causes this problem. At this stage it looks
>like I need to remove them one at a time to trace where the error
>comes from. I just thought there might be a more efficient process of
>identifying the rogue trigger.

That won't necessarily solve things if you're getting the same error in
more than one trigger.

You could create a custom exception for the down-track triggers and alter
them temporarily to catch the exception you're looking for. Guessing here
as to which exception you're tracking (gdscode 335544334,
isc_convert_error) so substitute it for the actual error you're getting.

create exception debug_me '???????';
commit;

alter trigger blah_blah
as
declare whoami varchar(78);
begin
whoami = 'blah_blah';
begin
....
blah;
end
when any do
begin
if (gdscode = 335544334) then
exception debug_me whoami || ' ' || 'has a bad conversion error';
else exception;
end

or, to trap the specific gdscode:

alter trigger blah_blah
as
declare whoami varchar(78);
begin
whoami = 'blah_blah';
begin
....
blah;
end
when gdscode convert_error do
exception debug_me whoami || ' ' || 'has a bad conversion error';
end

If you're likely to be getting more than one type of programmer error in
your trigger chain, make the debug error handlers more generalised.

./hb