I am trying to write c# function to read some data from oracle table
My functions:
public static writeConsole(string query, string connectionString, string driver)
{
//driver = Oracle.ManagedDataAccess.Client
using (var conn = DbProviderFactories.GetFactory(driver).CreateConnection())
{
using (var cmd = conn.CreateCommand())
{
cmd.Connection.ConnectionString = connectionString;
cmd.CommandType = CommandType.Text;
cmd.CommandText = query;
foreach (var item in ReadDouble(cmd))
{
Console.WriteLine(item);
}
}
}
}
private static IEnumerable<double> ReadDouble(IDbCommand cmd)
{
using (var r = cmd.ExecuteReader())
{
while (r.Read())
yield return r.GetDouble(0);
}
}
There is no problem in connection, nor executing query.
When I read data from oracle table in type number(9) it returns proper values I am expecting.
When I read data from table, where type is number(9,2) it returns empty value (like empty table).
Notice: This is only sample of the code. It has to be written using IDb interfaces
Thank you for help
Possibly it is problem with type mapping. Try this:
http://docs.oracle.com/html/E10927_01/featSafeType.htm#i1008428
And this:
https://community.oracle.com/message/3582080