[英]ORA-06550: line 1, column 37: PLS-00201: identifier 'XYZ' must be declared
When i try to access and excute a store procedure through following C# code Here is my C# code 当我尝试通过以下C#代码访问和执行存储过程时,这是我的C#代码
OracleParameter op = null;
OracleDataReader dr = null;
OracleCommand cmd = new OracleCommand();
cmd.CommandText = "pkg_prov_index.getNextPanel";
cmd.CommandType = CommandType.StoredProcedure;
op = new OracleParameter("pCurrentPanelId", OracleDbType.Int32);
op.Direction = ParameterDirection.Input;
op.Value = masterProviderIndex.CurrentPanelId;
cmd.Parameters.Add(op);
op = new OracleParameter("pRefCursor", OracleDbType.RefCursor);
op.Direction = ParameterDirection.inputOutput;
cmd.Parameters.Add(op);
dr =cmd.ExecuteReader(); Here , it gives me an error that says ORA-06550: line 1, column 37: PLS-00201: identifier 'XYZ' must be declared at
if(dr.HasRows)
{while(dr.Read())
{
}
}
I do have the permissions to access and execute the stored procedure so no issues with that. 我确实具有访问和执行存储过程的权限,因此没有任何问题。 And when I opened and saw the Stored Procedure in Sql Developer it has an input and output cursor(input cursor is there for reading so many columns as SP is just nothing but a select statement along with a where clause on a View which is written involving 5 tables together and then output cursor is for writing the output result of that SP).Thats what my understanding of cursor is ..since I'm a .Net guy not an oracle expert.Now coming back to the most important point.
当我打开并看到Sql Developer中的存储过程时,它有一个输入和输出游标(输入游标在那里可以读取这么多列,因为SP只是一个select语句,而一个View的where子句则包含在其中,将5个表放在一起,然后输出游标用于写入该SP的输出结果。这就是我对游标的理解,因为我是.Net而不是oracle专家。现在回到最重要的一点。 If you guys look in to my code for input/output cursor all I get is oracledbtype.refcursor in C# enumeration for oracledbtype but the oracle SP is using an input/ouput cursor, is this the root of my error, because I'm sending an input/output parameter as refcursor whereas oracle SP has input/output cursor not a refcursor, but refcursor is all I get when writing code using C#.
如果你们查看我输入/输出游标的代码,我得到的只是oracledbtype的C#枚举中的oracledbtype.refcursor,但是oracle SP使用的是输入/输出游标,这是我错误的根源,因为我正在发送输入/输出参数作为refcursor,而oracle SP的输入/输出游标不是refcursor,但是refcursor是我在使用C#编写代码时得到的全部。 Your help will be much appreciated.
您的帮助将不胜感激。 Thanks.
谢谢。
Before the CommandText
You should try giving a name to the procedure like this: 在
CommandText
之前,您应尝试为该过程命名,如下所示:
OracleCommand cmd = new OracleCommand("getNextPanel", _conn);
The parameter OracleParameter
must match exactly the parameter name(not only the type) when you call it by CommandType.StoredProcedure
当您通过
CommandType.StoredProcedure
调用时,参数OracleParameter
必须与参数名称(不仅是类型)完全匹配。
Why is there cmd.Parameters.Add(op);
为什么会有
cmd.Parameters.Add(op);
going twice? 要去两次? Also,
op.Direction = ParameterDirection.inputOutput;
另外,
op.Direction = ParameterDirection.inputOutput;
the "i" letter must be upper cased (probably typo). “ i”字母必须大写(可能是错字)。
The steps given is taken by a working example which I developed, following these steps: Calling Oracle stored procedure from C#? 给出的步骤由我开发的一个工作示例执行,遵循以下步骤: 从C#调用Oracle存储过程?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.