Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP !!!

Status
Not open for further replies.

hameja

Programmer
Oct 15, 2003
42
0
0
BE
Dear all
How can I sum a character filed
example

 
That is a very good question. How can you if it is character?

Are you saying your character field only contains numbers? Can you guarantee this? If so, look at using TO_NUMBER.
 
Is coming wioth an error invalid number

look at this
select distinct(ltrim(method)) "METHOD",
substr(datehourmin,1,8) "DATE"
to_num(currency)
from min_in
group by method,substr(datehourmin,1,8)

I want to sum on this field.

John
 
Hi,
SUM on What field - to_num(currency) ? Is Currency a character field? - Always?

What error?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Yes currency is a varchar

error invalid number
 
OK,
That means the one of more of the records has a non-numeric character in the currency field, so you would need to correct the data or exclude those records.

After that , you should be able to use the Sum(to_num(currency)) function in your query..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top