执行查询时出现无效的数字错误

时间:2017-11-03 12:46:19

标签: sql oracle

我需要您的帮助,因为我收到的错误,我使用以下查询才能查看表格中某个百分比列的平均值,但它给出了以下错误消息:

ORA-01722: invalid number
01722. 00000 -  "invalid number"
*Cause:    
*Action:

查询:

SELECT 'Skybox' as Platform,avg(PER_OF_VIOLATING_RULES) as 
ComplianceCalculation from table_name

PER_OF_VIOLATING_RULES列中的值:

PER_OF_VIOLATING_RULES
32.08%
55.77%
54.19%
54.84%
16.13%
23.22%
29.50%
5.56%
48.50%
56.04%

PER_OF_VIOLATING_RULES列是varchar2数据类型。

1 个答案:

答案 0 :(得分:0)

尝试替换%符号:

 SELECT 'Skybox' as Platform,avg(replace(PER_OF_VIOLATING_RULES, '%', '')) as ComplianceCalculation from table_name