为什么我无法执行存储过程? (OracleException 被捕获)
这是连接到 Oracle 数据库的代码。它在最后一行失败: dbDataAdapter.Fill(dtResult);
private object Execute(CommandType commandType, Common.DATA.SqlCommonExecutionType sqlCommonExecutionType, DbCommand dbCommand)
dbc = dbConnection.CreateCommand();
dbc.CommandType = commandType;
dbc.CommandText = dbCommand.CommandText;
dbc.CommandTimeout = 3600;
if (dbc.Connection.State == ConnectionState.Closed)
dbc.Connection.Open();
DataTable dtResult = new DataTable();
DbDataAdapter dbDataAdapter = dbProviderFactory.CreateDataAdapter();
dbDataAdapter.SelectCommand = dbc;
dbDataAdapter.Fill(dtResult);
错误是“OracleRxception 被捕获:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'RESETUNFINISHEDJOBS' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
我可以通过 Oracle SQL*Plus 访问数据库。为什么我会收到此错误?数据库端是否缺少存储过程,还是我的代码?关于如何解决此问题的任何想法?
This is code to connect to an Oracle database. It fails at the last line: dbDataAdapter.Fill(dtResult);
private object Execute(CommandType commandType, Common.DATA.SqlCommonExecutionType sqlCommonExecutionType, DbCommand dbCommand)
dbc = dbConnection.CreateCommand();
dbc.CommandType = commandType;
dbc.CommandText = dbCommand.CommandText;
dbc.CommandTimeout = 3600;
if (dbc.Connection.State == ConnectionState.Closed)
dbc.Connection.Open();
DataTable dtResult = new DataTable();
DbDataAdapter dbDataAdapter = dbProviderFactory.CreateDataAdapter();
dbDataAdapter.SelectCommand = dbc;
dbDataAdapter.Fill(dtResult);
The error is "OracleRxception was caught:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'RESETUNFINISHEDJOBS' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I have access to the database through Oracle SQL*Plus. Why am I getting this error? Is the stored procedure missing on the database side or is it my code? Any ideas of how to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要在命令文本中定义schema.package.storedprocedure(或schema.table)
而不是:
使用:
...这同样适用于函数/存储过程
如果您的 commandText 仅包含存储过程:
尝试:
You may need to define
schema.package.storedprocedure
(orschema.table
) in your commandtextInstead of:
Use:
... and the same applies for functions/stored procedures
If your commandText contains just the stored procedure:
Try:
另外,您可能想使用公共同义词。为对象创建公共同义词通常是比显式使用所有者/模式方法更好的方法。使用这种方法,这些对象的用户不需要担心 schema.someObject 表示法。
Also, you may want to use public synonyms. Its usually a better approach to create public synonyms for an object rather than explicitly using the owner/schema approach. The user of these objects shouldn't need worry about schema.someObject notation with this approach.