Reputation: 51
When running cmd.ExecuteNonQuery
, the following error is displayed:
System.Exception: 'ORA-06550: Line 1, Column 13: PLS-00103: The symbol "NET_BUSCAR_SOCIO_P1" was found when one of the following symbols was expected:
:= . ( @ % ;
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();
}
}
}
}
Upvotes: 1
Views: 296
Reputation: 65054
When using cmd.CommandType = CommandType.StoredProcedure;
then the CommandText
should contain only the name of the stored procedure, i.e:
cmd.CommandText = "NET_BUSCAR_SOCIO_P1";
Upvotes: 2