Problem with Directpathloader

ThomasW69

Member
I have a problem with DirectPathloader

when executing following code I will get a

ORA-01841 (year < -4713 or zero or >+9999)
Row =0, Column = 1


error in the sourcecode line of 'Ldr.Load(Row);'

Code:
/Fill the array
    for i := 0 to .... do
    begin
      resarray[i].dts:=formatdatetime('dd.mm.yyyy hh:nn:ss',dt); //String
...
    end;
...
    ldr.DateFormat:='DD.MM.YYYY HH24:MI:SS';
    ldr.Column[1].DataSize:=21;
    ldr.Column[1].DateFormat:='DD.MM.YYYY HH24:MI:SS';

  for i := 0 to length(Resarray) - 1 do
  begin
...
    ldr.Column[1].SetData(Row, @Resarray[i].dts[1], length(Resarray[i].dts));
...

    Inc(Row);
    // We have filled the array, or we are at the end of the file: load it
    if (Row = Ldr.MaxRows) or (i = length(Resarray) - 1) then
    begin
      try
        Ldr.Load(Row);
      except
        on E:EOracleError do
        begin
          showmessage(E.Message + #13#10#13#10 +
...

The date format of the loader is set correct and also the dateformat in the field. The resarray.dts contains strings like '01.07.2012 00:00:00'. There are no constraints in the table.

What could be the problem?
 
And this is the tabe to be filled with data.

Code:
create table HD_TIMESERIES_VALUES
(
  TS_ID   NUMBER(20) not null,
  VTIME   DATE not null,
  VALUE   NUMBER(10,3) default 0 not null,
  STATUS1 VARCHAR2(1),
  STATUS2 VARCHAR2(1),
  VDATUM  DATE,
  constraint PK_TIMESERIES_VAL primary key (TS_ID, VTIME)
)
organization index;
 
It is Delphi 2009 Enterprise.

Code:
Type
   TDateValue= record
      dt: TDatetime;
      dts:string;
      value: double;
    end;

var resarray:Array of TDateValue;

The "dts" was inserted into TDatevalue for the loader to handle the datetime "dt" field VTIME in the table as string. So the datatype in the loader for "VTIME" is dpString and the size is 21 char.

Code:
var dt:TDatetime;
...
resarray[i].dt :=dt; //TDatetime
resarray[i].dts:=formatdatetime('dd.mm.yyyy hh:nn:ss',dt); //String
...

 
I solved the probem by replacing

Code:
TDateValue= record
      dt: TDatetime;
      dts:string;
      value: double;
    end;

with

Code:
TDateValue= record
      dt:    TDatetime;
      dts:   ansistring;  //<-!!
      value: double;
    end;

Since Delphi 2009 unicode strings are supported so that the string-type consists of 2 bytes per character. It looks like the TDirectoraclePathloader can not handle unicode strings in my DOA Version.
 
Back
Top