Page 1 of 1

OracleLoader & TimeStamp Column = NULL

Posted: Wed 21 Sep 2016 01:25
by ZZZ_Projects
Version: 9.1.97

All types seem to work, but it doesn’t work correctly with type OracleDbType.TimeStamp.

I try to set the value from various method but every time the value in the Database is inserted to NULL and the DATEINSERT property is never NULL.

It’s possible to tell but what I’m doing wrong or there is an issue with TimeStamp type?

Code: Select all

ctx.Database.Connection.Open();
using (var copy = new OracleLoader("SYSTEM.ISSUE_406", (OracleConnection) ctx.Database.Connection))
{
    copy.Columns.Add("ID", OracleDbType.Raw, 16);
    copy.Columns.Add("COLUMNINT", OracleDbType.Number, 10, 0);
    copy.Columns.Add("DATEINSERT", OracleDbType.TimeStamp, 7);

    copy.Open();
    for (int i = 0; i < 10; i++)
    {
        var entity = list[i];
        copy.SetValue("ID", entity.ID.ToByteArray());
        copy.SetValue("COLUMNINT", entity.COLUMNINT);
        //copy.SetValue("DATEINSERT", entity.DATEINSERT.Value); // DO NOT WORK
        //copy.SetValue("DATEINSERT", new OracleTimeStamp(entity.DATEINSERT.Value)); // DO NOT WORK
        //copy.SetDate("DATEINSERT", entity.DATEINSERT.Value); // DO NOT WORK
        //copy.SetTimeStamp("DATEINSERT", entity.DATEINSERT.Value); // DO NOT WORK
        copy.SetTimeStamp("DATEINSERT", new OracleTimeStamp(entity.DATEINSERT.Value)); // DO NOT WORK
        copy.NextRow();
    }
}

Re: OracleLoader & TimeStamp Column = NULL

Posted: Thu 22 Sep 2016 15:29
by Pinturiccio
Please add a value to the copy.Columns["DATEINSERT"].DateFormat property. For example, such a value:

Code: Select all

copy.Columns["DATEINSERT"].DateFormat = "DD.MM.YYYY fmHH24fm:MI:SS.FF";
For more information, please refer to https://www.devart.com/dotconnect/oracl ... ormat.html

You can also use the CreateColumns method instead of creating columns manualy. For more information, please refer to https://www.devart.com/dotconnect/oracl ... lumns.html

Re: OracleLoader & TimeStamp Column = NULL

Posted: Sat 24 Sep 2016 14:30
by ZZZ_Projects
Thank you @Pinturiccio,

I confirm both solution are working.