Oracle ODAC x64位问题,此操作不支持Append_values提示批处理错误模式

时间:2018-02-28 15:30:03

标签: c# oracle for-loop odac

我正在使用x64位ODAC从.net webservice连接到oracle 11g。 代码失败:"错误:ora-38910:此操作不支持批处理模式"使用append_values提示执行查询时。 x64位oracle客户端版本2.112.1.0是否支持此提示。相同版本的x86位oracle客户端工作正常。

OracleParameter[] aryParams = null;
System.Text.StringBuilder SQlcols = new System.Text.StringBuilder();
System.Text.StringBuilder SQLvalues = new System.Text.StringBuilder();
System.Text.StringBuilder SQL = new System.Text.StringBuilder();
Int32 pNum = 1;

if (colFields.Count > 0)
{
    foreach (tblField fld in colFields.Values)
   {
       if (!fld.IsStaticValue)
        {
            fld.CleanUp();
            if (fld.ValueArray == null)
            {
                return false; // If no values were added to the arrays, exit function
            }

            if (aryParams == null)
            {
                aryParams = new OracleParameter[1];
            }
            else
            {
                OracleParameter[] aryParams2 = new OracleParameter[aryParams.Length + 1];
                Array.Copy(aryParams, aryParams2, aryParams.Length);
                aryParams = new OracleParameter[aryParams2.Length];
                Array.Copy(aryParams2, aryParams, aryParams.Length);
            }

            aryParams[aryParams.GetUpperBound(0)] = new OracleParameter("", fld.DataType, ParameterDirection.Input);
            aryParams[aryParams.GetUpperBound(0)].Value = fld.ValueArray;
            SQLvalues.Append(":");
            SQLvalues.Append(pNum);
            SQLvalues.Append(",");  //create csv of param numbers.
            pNum += 1; //increment param number
        }
        else
        {
            if (fld.StaticValue is string)
            {
                SQLvalues.Append("'");
                SQLvalues.Append(fld.StaticValue);
                SQLvalues.Append("',"); //create csv of param numbers.
            }
            else
            {
                SQLvalues.Append(fld.StaticValue);
                SQLvalues.Append(",");
                //create csv of param numbers.
            }
        }
        SQlcols.Append(fld.FieldName);
        SQlcols.Append(",");
        //create csv of field names
    }
    // Trim off trailing commas
    SQlcols = SQlcols.Remove(SQlcols.Length - 1, 1);
    SQLvalues = SQLvalues.Remove(SQLvalues.Length - 1, 1);
    SQL.Append("INSERT /*+ append_values */ INTO ");
    // SQL.Append("INSERT INTO ");
    SQL.Append(this._tblName);
    SQL.Append(" (");
    SQL.Append(SQlcols.ToString());
    SQL.Append(") VALUES (");
    SQL.Append(SQLvalues.ToString());
    SQL.Append(")");
    try
    {


        if (dat.ExecuteNonQuery(SQL.ToString(), false, aryParams) > 0)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    catch (Exception ex)
    {
        throw (ex);
    }
    finally
    {
        // clean up
       Int32 i;
        for (i = 0; i <= aryParams.GetUpperBound(0); i++)
        {
            aryParams[i].Dispose();
        }
    }
}
else
{
    return false;
}

0 个答案:

没有答案