Subject | Re: [firebird-support] About UDF's problem |
---|---|
Author | Yang Jin |
Post date | 2005-08-15T01:06:22Z |
Thanks.
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.
regards.
Helen Borrie <helebor@...> 写道:
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
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "firebird-support" on the web.
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
---------------------------------
DO YOU YAHOO!?
雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱
[Non-text portions of this message have been removed]
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.
regards.
Helen Borrie <helebor@...> 写道:
At 09:59 PM 14/08/2005 +0800, Jinyang wrote:
>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
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Visit http://firebird.sourceforge.net and click the Resources item
on the main (top) menu. Try Knowledgebase and FAQ links !
Also search the knowledgebases at http://www.ibphoenix.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "firebird-support" on the web.
To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
---------------------------------
DO YOU YAHOO!?
雅虎免费G邮箱-中国第一绝无垃圾邮件骚扰超大邮箱
[Non-text portions of this message have been removed]