我删除了之前的问题,因为事实证明我的问题是辩证的,但我仍然遇到同样的问题。所以,我的 SELECT 语句中有以下几行:
COUNT(*) AS "Number of Buildings",
COUNT(*)/ SUM(COUNT(*)) over ()*100 AS "Portfolio Percentage: Buildings",
我想做的是将“%”连接到数字结果的末尾。我试过了:
COUNT(*)/ SUM(COUNT(*)) over ()*100 || TO_NUMBER('%') AS "Portfolio Percentage: Buildings",
和:
TO_VARCHAR(COUNT(*)/ SUM(COUNT(*)) over ()*100) || '%' AS "Portfolio Percentage: Buildings",
基本上,我已经尝试了将数字转换为 CHAR/VARCHAR 或将“%”转换为数字的所有变体,这是我能想到的。它们总是返回相同的错误,这是以下的一些变体:
Numeric value '%' is not recognized