运行Oracle命令时出现错误ORA-06550和PLS-00103

时间:2019-05-03 19:34:42

标签: c# oracle oraclecommand

运行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();
            }
        }
    }
}

1 个答案:

答案 0 :(得分:2)

使用cmd.CommandType = CommandType.StoredProcedure;时,CommandText应该只包含存储过程的名称,即:

                cmd.CommandText = "NET_BUSCAR_SOCIO_P1";