在 SSIS 2008 的脚本任务中使用 Oracle ODBC 驱动程序时出现问题
我遇到的问题可能与 SSIS 没有任何关系,但我想彻底解决。我试图使用基本相同的代码(使用 ODBC)访问 SQL Server、Sybase 和 Oracle。除了 Oracle 之外的所有内容都在工作(并不奇怪),但我不知道如何解决这个问题。
Oracle驱动程序是11.01.00.06版本。我能够成功连接到实例,但调用(对函数)失败。我猜测该错误与游标在本例中是一个参数有关(对于 SQL Server 和 Sybase 来说并非如此),并且我没有考虑它。但游标没有 OdbcType。
任何帮助或建议将不胜感激。
我收到的错误是 - 错误 [07001] [Oracle][ODBC][Ora]ORA-01008: 并非所有变量都绑定
调用代码 (C#)
NetworkProviderCon = new OdbcConnection(strCon);
NetworkProviderCon.Open();
NetworkProviderCmd.Connection = NetworkProviderCon;
NetworkProviderCmd.CommandType = CommandType.StoredProcedure;
NetworkProviderCmd.CommandText = "{CALL SP_NETWORK_IDL(?,?)}";
NetworkProviderCmd.CommandTimeout = this.Variables.CADATABASECORETIMEOUT;
//parameters to call SP
NetworkProviderParam1 = NetworkProviderCmd.Parameters.Add("@pdtStartTime", OdbcType.DateTime);
NetworkProviderParam1.Value = strStartDate;
NetworkProviderParam2 = NetworkProviderCmd.Parameters.Add("@pdtEndTime", OdbcType.DateTime);
NetworkProviderParam2.Value = strEndDate;
sqlDr = NetworkProviderCmd.ExecuteReader();
过程参数
CREATE OR REPLACE function XXXX.SP_NETWORK_IDL
(
/*************************************************
** Declare Parameters **
*************************************************/
pRESULT_CURSOR IN OUT CURSOR_PACKAGE.RESULT_CURSOR ,
pdtStartTime IN CMC_NWPR_RELATION.NWPR_TERM_DT%TYPE := NULL,
pdtEndTime IN CMC_NWPR_RELATION.NWPR_EFF_DT%TYPE := NULL
)
return number
The issue I'm having may not have anything to do with SSIS but I wanted to be thorough. I am attempting to have essentially the same code (using ODBC) accessing SQL Server, Sybase, and Oracle. Everything except Oracle is working (not surprising) but I'm at a loss as to how to resolve this issue.
The Oracle driver is the 11.01.00.06 version. I am able to connect successfully to the instance but the call (to the function) fails. I'm guessing the error has to do with the fact that the cursor is a parameter in this case (not true for SQL Server and Sybase) and I am not accounting for it. There is no OdbcType for cursor though.
Any help or suggestions would be appreciated.
The error I am getting is - ERROR [07001] [Oracle][ODBC][Ora]ORA-01008: not all variables bound
Calling code (C#)
NetworkProviderCon = new OdbcConnection(strCon);
NetworkProviderCon.Open();
NetworkProviderCmd.Connection = NetworkProviderCon;
NetworkProviderCmd.CommandType = CommandType.StoredProcedure;
NetworkProviderCmd.CommandText = "{CALL SP_NETWORK_IDL(?,?)}";
NetworkProviderCmd.CommandTimeout = this.Variables.CADATABASECORETIMEOUT;
//parameters to call SP
NetworkProviderParam1 = NetworkProviderCmd.Parameters.Add("@pdtStartTime", OdbcType.DateTime);
NetworkProviderParam1.Value = strStartDate;
NetworkProviderParam2 = NetworkProviderCmd.Parameters.Add("@pdtEndTime", OdbcType.DateTime);
NetworkProviderParam2.Value = strEndDate;
sqlDr = NetworkProviderCmd.ExecuteReader();
Procedure Parameters
CREATE OR REPLACE function XXXX.SP_NETWORK_IDL
(
/*************************************************
** Declare Parameters **
*************************************************/
pRESULT_CURSOR IN OUT CURSOR_PACKAGE.RESULT_CURSOR ,
pdtStartTime IN CMC_NWPR_RELATION.NWPR_TERM_DT%TYPE := NULL,
pdtEndTime IN CMC_NWPR_RELATION.NWPR_EFF_DT%TYPE := NULL
)
return number
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的函数请求 3 个参数,但您只传递 2 个。
UPD:
MSDN:使用带有 OleDbCommand 或 OdbcCommand 的参数
PS:我找不到光标
UPD2 的 OdbcType:
Your function requests 3 parameters, but you are passing only 2.
UPD:
MSDN: Using Parameters with an OleDbCommand or OdbcCommand
P.S.: I can not find OdbcType for cursor
UPD2: