Subject Re: Problems with default values...
Author fidel_filio
Hello Ann and Hellen,

Thank you so much for your time and help. Our first approach indeed it was the before insert/before update trigger to give this column a default value but in some cases the trigger does not do its duty (it seems to have a mind of its own) and we don´t know why null values ended up being saved in this field even with the trigger on. That´s why we resorted to make this column not nullable.

We agree that we are using a very old FB version but right now an upgrade is not an option due to the many legacy systems we have to keep running and support.

Thanks for putting us back in the right track.

Best regards,

-Fidel







--- In firebird-support@yahoogroups.com, Ann Harrison <aharrison@...> wrote:
>
> On Wed, Sep 12, 2012 at 8:56 PM, fidel_filio <fidel_filio@...> wrote:
>
> > ...
> > add hor_uactu varchar(2) default extract(hour from cast('now' as date))
> > not null
> >
> > I get this error:
>
> Invalid token.
> > SQL error code = -104.
> > Token unknown - line 3, char 34.
> > extract.
> >
> > Note:
> > I am using Firebird 1.5.6
>
>
> In addition to Helen's comments about using a varchar to hold a number and
> using a function in a default value, you're using an ancient version of
> Firebird which doesn't support the function EXTRACT at all. You might be
> able to get time by declaring the field to be of type time and assigning
> 'now' to it.
>
> Do yourself a favor and use a version of Firebird that's less than 10 years
> old.
>
> Good luck,
>
> Ann
>
> >
>
>
> [Non-text portions of this message have been removed]
>