Subject Re: [firebird-support] About UDF's problem
Author Yang Jin
But a new problem found.
Cast (Value1 as numeric(9,2)),Value1= 13.275,reuslt is 13.27;
Cast (Value2 as numeric(9,2)),Value2= 13.228,reuslt is 13.23;
what is the rule to round?

hope for your reply.

Helen Borrie <helebor@...> 写道:
At 09:59 PM 14/08/2005 +0800, Jinyang wrote:
> I want to convert 11.234 to 11.23(or 22.456 to 22.46) in stored
> procedure.I want to use the udf.First,I don't find which function is good.
>Second, I use round func,as the example,the result is null,why?

Perhaps the number is a floating point number. IBUDF's round() function
takes a scaled numeric. But round() does not truncate numbers, it removes
the decimal part of a scaled numeric and returns an integer.

>example in stored procedure:
>select sum(round(Field1))
>from table1,
>the result is null,but if:
>select sum(Field1)
>from table1,
>result is the value in talbe.

You don't need a UDF. Just use a CAST() expression:

select cast(sum(Field1) as numeric(9,2)) as Total
from table1



Visit and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at



Visit your group "firebird-support" on the web.

To unsubscribe from this group, send an email to:

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]