我有一个简单的包定义如下:
CREATE OR REPLACE PACKAGE wvParty IS
TYPE refParties IS REF CURSOR;
结束 wvParty;
创建或替换包体 wvParty 正在处理 proc_GetParties( p_party_name IN OUT VARCHAR2, x_party_info OUT refParties ) 开始 p_party_name := '%'||p_party_name||'%';
OPEN x_party_info FOR
SELECT party_id, party_number, party_type, party_name,
person_first_name, person_middle_name, person_last_name,
known_as, known_as2, known_as3, known_as4, known_as5
FROM hz_parties
WHERE 1=1
AND party_name LIKE p_party_name;
END;
结束 wvParty;
它在 oracle db 中创建,没有错误。在我的代码中,我尝试使用以下方法调用它:
try
{
OracleConnection conn = new OracleConnection(_connStr);
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "wvParty.proc_GetParties";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter partyName = new OracleParameter();
partyName.ParameterName = "p_party_name";
partyName.OracleDbType = OracleDbType.Varchar2;
partyName.Direction = ParameterDirection.InputOutput;
partyName.Value = "Bubba";
cmd.Parameters.Add(partyName);
OracleParameter refParties = new OracleParameter();
refParties.ParameterName = "x_party_info";
refParties.OracleDbType = OracleDbType.RefCursor;
refParties.Direction = ParameterDirection.Output;
cmd.Parameters.Add(refParties);
OracleDataReader rdr = cmd.ExecuteReader();
然而,当我这样做时,我得到了错误:
PLS-00302:必须声明组件“PROC_GETPARIES”。
所以我很茫然。我已经创建了 proc 作为包的一部分,我已经按照我认为应该的方式声明了它,但是我在解决这个问题时收效甚微。有什么建议吗?