如何将参数放入连接到 Oracle Database 11g 的 SSRS 2008 R2 中的查询
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4567596/
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
How to put a parameter into an query in SSRS 2008 R2 connected to an Oracle Database 11g
提问by Abraham Bruck
Putting a parameter into the query gets the following error:
将参数放入查询中会出现以下错误:
"ORA-01036: illegal variable name/number"
The query is:
查询是:
select * from t_accounts where account_number = @ReportParamter1
Without the where clause, the query runs fine
没有 where 子句,查询运行良好
Any ideas?
有任何想法吗?
thanx!
谢谢!
Abraham
亚伯拉罕
回答by O. Jones
Oracle wants its bound parameters to be denoted with colons, not @ signs. So you want
Oracle 希望它的绑定参数用冒号表示,而不是 @ 符号。所以你要
...where account_number = :ReportParamter1
回答by brywilliams
O. Jones highlighted the root but didn't go into as much detail as I needed to address this same issue/question. I had created the parameter in Visual Studio and as noted it has the '@' in the format of the parameter so when applied to the Dataset I got the error message. Unfortunately in the construct of the parameter in VS (I'm using 12) there isn't anything in the various options that allows designating a : in place of the @. What I discovered was after manually adding the parameter to my query in the Dataset, I then found it listed in the parameters area of the Dataset Properties - the parameter entered in query was set to the parameter made in VS. I removed the original and preview processed without issue.
O. Jones 强调了根源,但没有详细说明我需要解决的问题/问题。我已经在 Visual Studio 中创建了参数,并且如前所述,它在参数格式中有“@”,因此当应用于数据集时,我收到了错误消息。不幸的是,在 VS 中的参数构造(我使用的是 12)中,各种选项中没有任何内容允许指定 : 代替 @。我发现是在将参数手动添加到数据集中的查询后,然后我发现它列在数据集属性的参数区域中 - 在查询中输入的参数设置为在 VS 中创建的参数。我删除了原始和预览处理没有问题。