oracle ORA-00909: 无效的参数数量错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24765241/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ORA-00909: invalid number of arguments ERROR
提问by moe
I have sql sever that is using a linked server to Oracle and i am trying to sum and count some values but getting the above error. I am trying to group it by Dept Code and Fac Code but I am not sure what am i doing wrong here? Please note i am pulling the data from Oracle server. Here is what i have:
我有一个 sql 服务器,它使用连接到 Oracle 的链接服务器,我试图对一些值进行求和和计数,但出现上述错误。我正在尝试按部门代码和 Fac 代码对其进行分组,但我不确定我在这里做错了什么?请注意,我正在从 Oracle 服务器中提取数据。这是我所拥有的:
SELECT * FROM OPENQUERY (MYLINKEDSERVER,'SELECT LTRIM(CODE) AS FAC_CODE,
COUNT(ACCOUNT_NO)AS ACCOUNT_NO,
LTRIM(DEP_CODE) AS DEP_CODE,
SUM(UNITS) AS TOTAL_UNITS,
ROUND(SUM(CHARGES, 2)) AS CHARGES
from myTable
group by CODE, DEP_CODE ' )
回答by Gordon Linoff
My best guess is the round()
function. It takes two arguments, not sum()
:
我最好的猜测是round()
函数。它需要两个参数,而不是sum()
:
ROUND(SUM(CHARGES), 2) AS CHARGES