Page 1 of 1

Using TOraLoader with a Timestamp column

Posted: Tue 29 Mar 2005 12:05
by JimA
I am trying to load a TDateTime variable into an Oracle table that has a timestamp column. The milliseconds in the time are being truncated in the Oracle table.

Posted: Wed 30 Mar 2005 06:07
by Alex
The Oracle Direct path feature doesn't support timestamps, so to download data in such case you should use DML array feature, e.g. we have a table with TimeStamp on the server:

Code: Select all

Table TimeStampTest (
  StartTime TIMESTAMP(3)
)
then to fill this table with 100 rows we can use the next code:

Code: Select all

  RecCount := 100;
  OraSQL.SQL.Clear;
  OraSQL.SQL.Text := 'INSERT INTO TimeStampTest  (StartTime) VALUES
(:StartTime)';
  OraSQL.ParamByName('StartTime').DataType := ftTimeStamp;
  OraSQL.ParamByName('StartTime').ParamType := ptInput;
  OraSQL.ArrayLength := RecCount;
  for  i := 1 to RecCount do begin
    OraSQL.ParamByName('StartTime').ItemAsTimeStamp[i].Format := 'DD.MM.YYYY HH24:MI:SS.FF';
    OraSQL.ParamByName('StartTime').ItemAsTimeStamp[i].AsString := '01.04.2005 12:01:02.03';
  end;
  OraSQL.Execute(RecCount);