Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Precision Problem with CFQUERY

Explorer ,
Mar 30, 2008 Mar 30, 2008
I have a column in Oracle which is a Number with precision 10, and scale 4.
Everytime I select anything from there from CF, it is displaying all 4 decimals.
Say the number "1" is in one record, "2.2" is in the second record, "3.0003" is in the third.
when I do a select all in a cfquery, I get:
1.0000
2.2000
3.0003
but if I were to select it in SQLPLUS, I get:
1
2.2
3.003
which is the result I desire. Why is Cold fusion adding zeros to the cfquery? And how can I fix this?
Thanks,
boybles
TOPICS
Getting started
422
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 31, 2008 Mar 31, 2008
A quick and dirty workaround would be to multiply the retrieved number by 1 - <CFSET foo = queryName.myNumber * 1>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 31, 2008 Mar 31, 2008
Use #val(your_col)# to display the result as you desire in the output. It will "convert" your numeric "string" back to a number and drop the trailing zeros.

Phil
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 31, 2008 Mar 31, 2008
LATEST
Numberformat function would be helpful. 🙂
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources