Regarding my TRUNC function problem, it seems that is has more to do with
Java JDBC driver than with the database. The idea is that queries "select
trunc(5.6687, 1) test from dual" and "select trunc(5.6687, (select 1 from
dual)) test from dual" show up as different results under Java /
DbVisualizer. The results are shown as "5.6" and "5.6000". When I'm using
other clients, such as SQL Studio, the correct result is returned in both
cases.

It seems that DbVisualizer uses metadata from query to format the result -
and in first case it receives the correct metadata, but in second it gets
from JDBC driver that "scale" should be 4 instead of 1.

I wonder if someone using Java / JDBC could confirm this problem.

Regards,
Andris Spruds


----- Original Message ----- 
From: "blackDoggy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 07, 2004 4:16 AM
Subject: Problems with TRUNC function


Hello,


It seems I have a problem :(( I can't get TRUNC function to work expected.
TRUNC only seems to work when the second parameter does not come from
database (e.g. TRUNC(measurement, 2) works perfectly well). If it's comes
from a table, then it returns the original parameter instead of truncated
one.

I also tried to create a function, however, it does not work as expected as
well.

CREATE DBFUNCTION trunc_measurement (measurement FIXED(14,7), precision_id
INT) RETURNS NUMBER AS
TRY
    RETURN TRUNC(measurement, precision_id);
CATCH
    RETURN NULL;

Is there anything I could do to get it working? Or am I - as it usual
happens :) - missing something?

Thanks,
Andris


P.S.
I am using MaxDB 7.5.05







-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]






-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to