Subject RE: [firebird-support] Re: expression evaluation not supported (FIREBIRD 2.0 RC3)
Author Alan McDonald
> > I know nothing about Firebird 2.0, but the below statement does
> refer to
> > 'a1' (ai.id) which is a non-existing table.
> >
> > HTH,
> > Set
>
> Sorry (it's not A1, but S1) mea culpa.
> SURE all tables exists, and all type are correct.
> The problem is due to a new restriction in FB 2.0 (work fine in FB
> 1.5) Anyone use computed fields implicating other tables, and with
> similar errors? any solution about this?

I've just gone thru an app with queries like this. In my case I was not
casting correctly. In fact, in Interbase 6.0 there was no need to cast a
string to numeric at all to achieve multiplication, it would cast on the fl
for you. Now you need to cast specifically and exactly. I wonder if your
casting is overrunning the space.
cantidad and precio are what types?
dto is wht type?
what about using NEW.id instead of s1.id?

Alan

>
> > > /**********************************/
> > >
> > > ALTER TABLE S1 ADD BASE COMPUTED BY (
> > > cast(
> > > coalesce(
> > > (select sum(cast(s2.cantidad*s2.Precio as numeric(14,4))
> > > *cast((1.0-s2.dto/100)*(1.0-s1.dto/100) as numeric(6,5)))
> > > from s2
> > > where s1.id = s2.id)
> > > ,0)
> > > as numeric(14,2)));
> > >
> > > /**********************************/