Subject Re: [firebird-support] bde error caused by trigger
Author Yves Glodt
On Tuesday 18 November 2003 13:21, Helen Borrie wrote:
> At 12:11 PM 18/11/2003 +0100, you wrote:
> >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:
> >How would such a trigger/stored proc look like?
>
> set term ^;
> 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.

Error? The code I posted works perfectly for me through isql.
I need pers_numer as varchar, because I need the leading zeros, and
because in the table definition it's a varchar.
The initial problems seems to be a bde issue.

thank you

> h.
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~--> Buy Ink Cartridges or Refill Kits for your
> HP, Epson, Canon or Lexmark Printer at MyInks.com. Free s/h on orders
> $50 or more to the US & Canada.
> http://www.c1tracking.com/l.asp?cid=5511
> http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/67folB/TM
> ---------------------------------------------------------------------
>~->
>
> To unsubscribe from this group, send an email to:
> firebird-support-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/

--
Linux 2.4.22-1-k7 #1 Sat Sep 6 02:13:04 EST 2003 i686
19:03:01 up 32 min, 1 user, load average: 0.15, 0.09, 0.18