Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 20 total
Thread Problem with Query
Tue, Mar 8 2011 11:05 AMPermanent Link

Francisco Fernandez

NewTRON Informatica

Avatar

Hi.

EDB 2.03 b21

I have a table where I execute this sql code:

SELECT * FROM LOTES WHERE ARTICULO='171004' AND ALMACEN='02' AND EXIST>0 ORDER BY FECHA

The query results one record but this record have field EXIST=0 and I don't know why.

Thanks and regards.
Tue, Mar 8 2011 12:05 PMPermanent Link

John Hay

Francisco
> I have a table where I execute this sql code:
>
> SELECT * FROM LOTES WHERE ARTICULO='171004' AND ALMACEN='02' AND EXIST>0 ORDER BY FECHA
>
> The query results one record but this record have field EXIST=0 and I don't know why.

What type of field is EXIST?  If it is a float it might be fractionally above 0 (but display shows 0), if it is an
integer have you tried repairing the table?

John

Tue, Mar 8 2011 2:00 PMPermanent Link

Francisco Fernandez

NewTRON Informatica

Avatar

John.

Thank's for your response.

Field EXIST is a field type DECIMAL Scale 2
Wed, Mar 9 2011 11:23 AMPermanent Link

John Hay

Francisco
>
> Field EXIST is a field type DECIMAL Scale 2
>

OK this is floating point value.  If you change you query to the following does it give the correct result?

SELECT * FROM LOTES WHERE ARTICULO='171004' AND ALMACEN='02' AND EXIST>0.005 ORDER BY FECHA

John

Wed, Mar 9 2011 2:05 PMPermanent Link

Francisco Fernandez

NewTRON Informatica

Avatar


>>OK this is floating point value.  If you change you query to the following does it give the correct result?

>>SELECT * FROM LOTES WHERE ARTICULO='171004' AND ALMACEN='02' AND EXIST>0.005 ORDER >>BY FECHA

Yes, no rows with this query.
Wed, Mar 9 2011 7:37 PMPermanent Link

John Hay

> >>OK this is floating point value.  If you change you query to the following does it give the correct result?
>
> >>SELECT * FROM LOTES WHERE ARTICULO='171004' AND ALMACEN='02' AND EXIST>0.005 ORDER >>BY FECHA
>
> Yes, no rows with this query.
>

Looks like a rounding problem.  If you are using 2 decimal places you can correct the existing data by running an update
query like update lotes set exist=round(exist to 2).  If you need exact amounts you might want to think about holding
them as BCD or Integer fields.

John

Wed, Mar 9 2011 7:46 PMPermanent Link

John Hay

Oops that was a DBISAM answer.  I don't think Decimal 2 should allow rounding errors but I think Tim will have to
confirm.

John

Thu, Mar 10 2011 2:56 AMPermanent Link

Francisco Fernandez

NewTRON Informatica

Avatar

John.

Thank's for your help.
Sun, Mar 13 2011 5:56 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

John,

<< Oops that was a DBISAM answer.  I don't think Decimal 2 should allow
rounding errors but I think Tim will have to confirm. >>

No, a DECIMAL is a Currency value internally (max scale of 4), and shouldn't
have rounding issues.

--
Tim Young
Elevate Software
www.elevatesoft.com
Sun, Mar 13 2011 5:57 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Francisco,

<< Yes, no rows with this query. >>

Can you send me your database catalog along with this one table's files
(.edbtbl, .edbidx, and .edbblb) ?  I'd like to run this here and see what's
going on.

Thanks,

--
Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 2Next Page »
Jump to Page:  1 2
Image