Subject Re: [firebird-support] bde error caused by trigger
Author Lucas Franzen
> In the table it's a varchar(20) field, but it contains only integers.
> That's why I pad it with zeros. (btw is there a nicer way to do this?)

declare variable tmpnr VARCHAR(20);

tmpnr = CAST ( NEW.PERS_NUMBER AS VARCHAR(20) );

WHILE ( TMPNR NOT LIKE ( '____________________' ) DO
BEGIN
/* the compariosn consists of 20 * '_' */
/* --> if you always want to pad it to the length of 20 */
tmpnr = '0' || tmpnr;
END

NEW.PERS_NUMBER = tmpnr;


Luc.