Skip to main content
Participant
March 31, 2008
Question

Precision Problem with CFQUERY

  • March 31, 2008
  • 2 replies
  • 461 views
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
This topic has been closed for replies.

2 replies

Participating Frequently
March 31, 2008
Numberformat function would be helpful. :)
March 31, 2008
A quick and dirty workaround would be to multiply the retrieved number by 1 - <CFSET foo = queryName.myNumber * 1>
Participating Frequently
March 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