OracleLoader & TimeStamp Column = NULL

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
ZZZ_Projects
Posts: 4
Joined: Wed 21 Sep 2016 01:14

OracleLoader & TimeStamp Column = NULL

Post by ZZZ_Projects » Wed 21 Sep 2016 01:25

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();
    }
}

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: OracleLoader & TimeStamp Column = NULL

Post by Pinturiccio » Thu 22 Sep 2016 15:29

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

ZZZ_Projects
Posts: 4
Joined: Wed 21 Sep 2016 01:14

Re: OracleLoader & TimeStamp Column = NULL

Post by ZZZ_Projects » Sat 24 Sep 2016 14:30

Thank you @Pinturiccio,

I confirm both solution are working.

Post Reply