运行cmd.ExecuteNonQuery
时,显示以下错误:
System.Exception:'ORA-06550:第1行,第13列: PLS-00103:当预期出现以下符号之一时,找到了符号“ NET_BUSCAR_SOCIO_P1”:
:=。 (@%;
using (OracleConnection con = new OracleConnection(connectionString))
{
using (OracleCommand cmd = con.CreateCommand())
{
try
{
cmd.CommandText = " CALL NET_BUSCAR_SOCIO_P1(vCPF,vExisteSocio,vMatricula,vCodTbSituacao,vNomSocio,vExisteDebito,vExisteRecebimento,vCodTipoSocio,vExisteChequeDev); ";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("vCPF", OracleDbType.Int64).Direction = ParameterDirection.Input;
cmd.Parameters["vCPF"].Value = cpf;
cmd.Parameters.Add("vExisteSocio", OracleDbType.Int16).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vMatricula", OracleDbType.Int16).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vCodTbSituacao", OracleDbType.Int16).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vNomSocio", OracleDbType.Varchar2, 35).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vExisteDebito", OracleDbType.NChar).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vExisteRecebimento", OracleDbType.Int16).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vCodTipoSocio", OracleDbType.Varchar2, 30).Direction = ParameterDirection.Output;
cmd.Parameters.Add("vExisteChequeDev", OracleDbType.Int16).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
int existesocio = (int)cmd.Parameters["vExisteSocio"].Value;
}
catch (Exception e)
{
throw new Exception(e.Message);
}
finally
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
}
}
}
答案 0 :(得分:2)
使用cmd.CommandType = CommandType.StoredProcedure;
时,CommandText
应该只包含存储过程的名称,即:
cmd.CommandText = "NET_BUSCAR_SOCIO_P1";