1

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();
            }
        }
    }
}
MarredCheese
  • 17,541
  • 8
  • 92
  • 91
Pedro Tomaz
  • 41
  • 1
  • 5

1 Answers1

2

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";
Luke Woodward
  • 63,336
  • 16
  • 89
  • 104
  • ORA-06502: PL / SQL: error: character string buffer too small numeric or value ORA-06512: on line 1 – Pedro Tomaz May 03 '19 at 20:30
  • 1
    @PedroTomaz: that's a separate error. The only character arguments to your stored procedure are output parameters so it seems you're calling the stored procedure okay but not making enough space for the values returned through the output parameters. You're also not specifying a size for `vExisteDebito`. – Luke Woodward May 03 '19 at 20:35
  • I will change and test. It's because I do not have access to db. – Pedro Tomaz May 03 '19 at 20:41
  • you solved the puzzle. Thank you. cmd.Parameters.Add("vExisteDebito", OracleDbType.NChar,6).Direction = ParameterDirection.Output; – Pedro Tomaz May 03 '19 at 20:47