我正在使用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;
}