Subject Re: Update numeric problem
Author timothysshea
Haven't tried either of those. The second example is closest to my workaround. Used the Select in a separate query to get the field value, then set the "total" to a numeric.

eg
update mytable set total=22.12 where mykey=10

The first example looks interesting. Will give them a go.

Many thanks,

Tim

> Hi Tim,
>
> I am sure you tried many things to find this error. Just to think about what you already tried or not. Did you tried something like this, besides total is realy NN (NotNull):
>
> update mytable set total=coalesce(total,200.1)+10.12 where mykey=10;
>
> or something like (if mykey is PK)
>
> update mytable set total= (Select m2.total from mytable m2 where m2.mykey =10)+10.12 where mykey=10;
>
> this can narrow this error to the operation with "total" column. allthough, option 2 can slown down your query a litle...
>


--- In firebird-support@yahoogroups.com, "emb_blaster" <EMB_Blaster@...> wrote:
>
>
>
> --- In firebird-support@yahoogroups.com, "timothysshea" <timothysshea@> wrote:
> >
> > I am having a problem where the following :
> >
> > update mytable set total=total+10.12 where mykey=10
> >
> > Simply doesn't work; occasionally. The numeric field is not null and no error is reported. The numeric field (total) is not updated.
> >
> > The command
> >
> > update mytable set total=22.2 where mykey=10
> >
> > always works.
> > Likewise
> >
> > update mytable set total=total+10.12, databasename='Firebird' where mykey=10
> >
> > always updates databasename to 'Firebird', but sometimes does not update total.
> >
> > Seems to happen on Terminal Servers more than other systems.
> > Using Win32 Firebird 2.1.3, Superserver via the ODBC driver build 2.00.00.148, but happened with Firebird 2.0 as well.
> >
> > This seems like a pretty basic problem and only happens occasionally. Otherwise, Firebird appears to be virtually bulletproof.
> >
> > Any ideas?
> >
> > Thanks in advance.
> > Tim
> >
>