使用Oracle OLE DB提供程序时如何解决SQL查询参数映射问题? [英] How to resolve SQL query parameters mapping issues while using Oracle OLE DB provider?

查看:154
本文介绍了使用Oracle OLE DB提供程序时如何解决SQL查询参数映射问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使用Oracle OLE DB提供程序输入带有参数的SQL查询时,出现以下错误:

When trying to enter a SQL query with parameters using the Oracle OLE DB provider I get the following error:

无法从SQL命令中提取参数.提供程序可能不帮助从命令中解析参数信息.在这种情况下,请使用来自变量的SQL命令"访问模式,在该模式下,整个SQL命令都存储在变量中.
其他信息:
提供程序无法派生参数信息,并且尚未调用SetParameterInfo. (用于Oracle的Microsoft OLE DB提供程序)

Parameters cannot be extracted from the SQL command. The provider might not help to parse parameter information from the command. In that case, use the "SQL command from variable" access mode, in which the entire SQL command is stored in a variable.
ADDITIONAL INFORMATION:
Provider cannot derive parameter information and SetParameterInfo has not been called. (Microsoft OLE DB Provider for Oracle)

我尝试按照此处的建议进行操作,但不太了解所需的内容:针对Oracle的参数化查询

I have tried following the suggestion here but don't quite understand what is required:Parameterized queries against Oracle

有什么想法吗?

推荐答案

在问题中给出的链接上进行扩展:

To expand on the link given in the question:

  1. 创建一个包变量
  2. 双击程序包变量名称. (这使您可以访问变量的属性)
  3. 将属性"EvaluateAsExpression"设置为true
  4. 在表达式生成器中输入查询.
  5. 将OLE DB源查询设置为来自变量的SQL命令

表达式构建器可以使用变量动态创建表达式以创建参数化查询".
因此,以下正常"查询:

The expression builder can dynamically create expressions using variable to create 'parametised queries'.
So the following 'normal' query:

select * from book where book.BOOK_ID = ?

可以在表达式生成器中编写为:

Can be written in the expression builder as:

"select * from book where book.BOOK_ID = " + @[User::BookID]

然后您可以使用表达式生成器进行空处理和数据转换.

You can then do null handling and data conversion using the expression builder.

这篇关于使用Oracle OLE DB提供程序时如何解决SQL查询参数映射问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆