Subject Re: [firebird-support] Problem createing before delete trigger
Author Helen Borrie
At 01:06 AM 9/06/2005 -0300, you wrote:
>Grant Brown wrote:
>
> >Hi all,
> >
> >I am trying to create a before delete trigger and when I try to save the
> >new trigger I get the following error.
> >
> >So whats wrong ?
> >
> >----- the trigger code -------
> >
> > execute procedure P_DELETE_MEMO_TYPE_1(VENDOR_EXP_ACCOUNTS.NOTESID);
> >
> >------- error recived ---------
> >
> >ISC ERROR CODE:335544351
> >
> >ISC ERROR MESSAGE:
> >unsuccessful metadata update
> >Name longer than database column size
> >
> >
> >
>Grant,
>
>You trigger name are longer than the maximum accepted length of a FB
>identifier. (I think 27 chars)
>
>Reduce the name of your trigger.

The maximum length of an identifier is 31 characters. This, for example,
works:

create trigger abcdefghijklmnopqrstuv12345 for employee
active before insert
as
begin
/* */
end

Whether or not it turns out that the trigger name you used is too long, you
have some bad syntax in the snippet of code you provided:

execute procedure P_DELETE_MEMO_TYPE_1(VENDOR_EXP_ACCOUNTS.NOTESID);

If you are executing a procedure from a trigger (or another procedure) you
need to provide either a variable or a constant value for the input
parameter. I'm guessing here about the *actual* trigger code but it should
go something like this:

create trigger BD_VENDOR_EXP_ACCOUNTS
for VENDOR_EXP_ACCOUNTS
active before delete
as
declare v_notesid integer;
begin
if (old.notesid is not null) then
begin
v_notesid = old.notesid;
execute procedure P_DELETE_MEMO_TYPE_1(:v_notesid);
end
end

Apart from that, to make any sense of the exception, we'd need to see the
actual trigger code that won't compile, and very likely also the header
part of the called SP.

./heLen