使用 .Net 中的参数调用 Oracle 存储过程的正确 odbc 命令是什么?
对于 MSFT SQL Server 08,它是:
odbcCommand = new OdbcCommand("{call " + SP_NAME + " (?,?,?,?,?,?,?) }", odbcConn);
当我尝试对 Oracle 执行相同的操作时,我得到:
OdbcException: ERROR [HYC00] [Oracle][ODBC]Optional feature not implemented.
请随时要求澄清,并请提供帮助。我正在使用.Net 3.5、SQL Server 08 和 Oracle 11g_home1。
PS Oracle 存储过程确实还有另外 3 个参数,但我相信我正在代码中处理这个参数。
In the case of MSFT SQL Server 08, it is:
odbcCommand = new OdbcCommand("{call " + SP_NAME + " (?,?,?,?,?,?,?) }", odbcConn);
When I try to do the same thing for Oracle, I get:
OdbcException: ERROR [HYC00] [Oracle][ODBC]Optional feature not implemented.
Feel free to ask for clarification, and please help. I am using .Net 3.5, SQL Server 08, and Oracle 11g_home1.
P.S. The Oracle stored procedure does have some 3 more parameters, but I believe I am handling this in my code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在运行 .NET 3.5 和 Oracle 10gR2。我添加了一个输出参数来响应您的评论。
Server
、Uid
和Pwd
已更改以保护无辜者。将它们设置为适当的值。我的存储过程:
我的测试代码:
使用
OUT
或IN OUT
参数时,OdbcParameter
的Size
属性必须设置为足够的值。为了回应您有关异常处理的评论,我会让数据访问方法的调用者处理异常。使用
using
构造,无论是否存在异常,都将在命令和连接对象上自动调用Dispose
方法。I'm running .NET 3.5 and Oracle 10gR2. I've added an output parameter in response to your comment.
Server
,Uid
, andPwd
have been changed to protect the innocent. Set them to appropriate values.My stored procedure:
My test code:
When using
OUT
orIN OUT
parameters, theSize
property of theOdbcParameter
must be set to an adequate value.In response to your comment regarding exception handling, I would have the caller of the data access method handle exceptions. With the
using
construct, theDispose
method will be called automatically on the command and connection objects whether there is an exception or not.