I need to read a CLOB field from an ORACLE table int a C# variable of type String. Does anyone know how to accomplish this task?
这就是我所做的,但是在计算字段的 GetOrdinal 时我得到了 IndexOutofRange。提前致谢。
public void ReadFunction(string FName, out string fContent)
{
OracleCommand command = _connection.CreateCommand();
OracleTransaction transaction = _connection.BeginTransaction();
command.Transaction = transaction;
command.CommandText = "SELECT TO_CLOB(TO_NCLOB(FUNCTION_SCRIPT)) FROM IS_FUNCTION where FNAME=:fName ";
command.Parameters.Add("FName", OracleType.NVarChar).Value = FName;
OracleDataReader odr = command.ExecuteReader();
int temp = odr.GetOrdinal("FUNCTION_SCRIPT");
OracleLob myLob = odr.GetOracleLob(temp);
fContent = (String)myLob.Value;
odr.close();
}