Subject RE: [ib-support] About default values
Author Doug Chamberlin
At 12/17/2001 02:57 PM (Monday), Kaputnik wrote:
>before insert:
>BEGIN
> IF (new.id IS NULL) THEN new.id=GEN_ID(GEN_something,1); //this is a
>tribute to IBO and its generatorlinks....
> new.SYS$CHANGED_AT='NOW';
> new.SYS$CREATED_AT='NOW';
> new.SYS$CHANGED_BY=CURRENT_USER;
> new.SYS$CREATED_BY=CURRENT_USER;
>END

Just two comments on what Nick wrote.

1) If it is important to have the SYS$CHANGED_AT and SYS$CREATED_AT values
precisely the same after an insert, you might want to change the above to

> new.SYS$CHANGED_AT='NOW';
> new.SYS$CREATED_AT=new.SYS$CHANGED_AT;

That way the NOW function will have no chance of returning two slightly
different values.

2) The latest FB and IB versions provide CURRENT_TIMESTAMP in place of
'NOW'. I think this is a big improvement so I like to point it out.