Home » SQL & PL/SQL » SQL & PL/SQL » How to sum formated numeric values (Oracle 10G)
How to sum formated numeric values [message #303653] Sat, 01 March 2008 11:47 Go to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
hi,

Table Name Chk_cal

id number primary key
col_a varchar2(10)
col_b varchar2(10)

The following values are stored
Col_a Col_b
raju 12,765.12
kumar 34,567.12

I just want sum col_b and store it in memory variable

I tried

select sum(to_number(col_b)) into mem_vari from chk_cal;

Error has come as wrong numeric identifier

Any one can help me without disturbing the formated number

yours
dr.s.raghunathan
Re: How to sum formated numeric values [message #303657 is a reply to message #303653] Sat, 01 March 2008 11:57 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Any one can help me without disturbing the formated number
No
This is the price you pay for storing a "number" in a varchar2 field.
What is in col_b is NOT a number but a string.
It is not valid to "sum" decimal point characters and/or comma characters.
Re: How to sum formated numeric values [message #303658 is a reply to message #303653] Sat, 01 March 2008 11:59 Go to previous message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
TO_NUMBER can take a format.
Why are you storing numbers in varchar2 columns? This is really stupid.

Regards
Michel
Previous Topic: Error while passing Filename and path to Stored Procedure
Next Topic: Need help understanding
Goto Forum:
  


Current Time: Thu Feb 06 23:43:18 CST 2025