Subject | Re: [firebird-support] bde error caused by trigger |
---|---|
Author | Helen Borrie |
Post date | 2003-11-18T12:21:57Z |
At 12:11 PM 18/11/2003 +0100, you wrote:
Here's the original suggested code from last Sunday:
create trigger bi_WT_PERS for WT_PERS
active before insert position 0 as
begin
if (NEW.PERS_NUMBER is null) then
NEW.PERS_NUMBER = cast(gen_id(gen_pers_number, 1) as varchar(20));
end ^
set term ;^
**************************
Fix up the data type mis-matching and at least *that* error will go away.
h.
>Hello,*****************************************
>
>I have this trigger (thanks to heLen for her help):
>
>CREATE TRIGGER CREATE_PERS_NUMBER FOR WT_PERS
>INACTIVE BEFORE INSERT POSITION 0
>as
>DECLARE VARIABLE prefix varchar(5);
>begin
>/* if (NEW.PERS_NUMBER is null) then NEW.PERS_NUMBER =
>gen_id(gen_pers_number, 1); */
> NEW.PERS_NUMBER = gen_id(gen_pers_number, 1);
Here's the original suggested code from last Sunday:
>set term ^;
>How would such a trigger/stored proc look like?
create trigger bi_WT_PERS for WT_PERS
active before insert position 0 as
begin
if (NEW.PERS_NUMBER is null) then
NEW.PERS_NUMBER = cast(gen_id(gen_pers_number, 1) as varchar(20));
end ^
set term ;^
**************************
Fix up the data type mis-matching and at least *that* error will go away.
h.