Pedro Tomaz
Pedro Tomaz

Reputation: 51

Error ORA-06550 and PLS-00103 When Running Oracle Command

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

Answers (1)

Luke Woodward
Luke Woodward

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

Related Questions