Subject | Re: [firebird-support] About UDF's problem |
---|---|
Author | Helen Borrie |
Post date | 2005-08-14T23:20:08Z |
At 09:59 PM 14/08/2005 +0800, Jinyang wrote:
takes a scaled numeric. But round() does not truncate numbers, it removes
the decimal part of a scaled numeric and returns an integer.
select cast(sum(Field1) as numeric(9,2)) as Total
from table1
./hb
>hello,Perhaps the number is a floating point number. IBUDF's round() function
> 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?
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:You don't need a UDF. Just use a CAST() expression:
>select sum(round(Field1))
>from table1,
>the result is null,but if:
>select sum(Field1)
>from table1,
>result is the value in talbe.
>
select cast(sum(Field1) as numeric(9,2)) as Total
from table1
./hb