OracleLoader & TimeStamp Column = NULL

OracleLoader & TimeStamp Column = NULL

Postby 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();
    }
}
ZZZ_Projects
 
Posts: 2
Joined: Wed 21 Sep 2016 01:14

Re: OracleLoader & TimeStamp Column = NULL

Postby 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/oracle/docs/?Devart.Data.Oracle~Devart.Data.Oracle.OracleLoaderColumn~DateFormat.html

You can also use the CreateColumns method instead of creating columns manualy. For more information, please refer to https://www.devart.com/dotconnect/oracle/docs/?Devart.Data.Oracle~Devart.Data.Oracle.OracleLoader~CreateColumns.html
Pinturiccio
Devart Team
 
Posts: 1893
Joined: Wed 02 Nov 2011 09:44

Re: OracleLoader & TimeStamp Column = NULL

Postby ZZZ_Projects » Sat 24 Sep 2016 14:30

Thank you @Pinturiccio,

I confirm both solution are working.
ZZZ_Projects
 
Posts: 2
Joined: Wed 21 Sep 2016 01:14


Return to dotConnect for Oracle