[Zope-dev] Oracle and MAX

Hannu Krosing hannu@trust.ee
Tue, 28 Sep 1999 11:19:43 +0300


Dan Rusch wrote:
> 
> Has anyone used the sql MAX() with Oracle. We were using Sybase and
> ported to Oracle and it seems that the MAX() in Oracle converts my real
> numbers to integers this did not happen in Sybase, any thoughts? By the
> way AVG() does the same
> 
> SELECT MAX("ItemNumber")
> FROM SO_Items
> WHERE "ServiceOrderID" = 1
> AND "ItemNumber" < 2
> 
> The ItemNumber is a number(9,3) in the table SO_Items.
> 
> By the way the sql code works fine in sqlplus.

It could be someting in the DA. You could try

SELECT STR(MAX("ItemNumber"))
FROM SO_Items
WHERE "ServiceOrderID" = 1
AND "ItemNumber" < 2

or

SELECT MAX("ItemNumber" * 1000.0)
FROM SO_Items
WHERE "ServiceOrderID" = 1
AND "ItemNumber" < 2

as a chack/workaround

-------------------
Hannu