Using TOraLoader with a Timestamp column

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JimA

Using TOraLoader with a Timestamp column

Post by JimA » Tue 29 Mar 2005 12:05

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.

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 30 Mar 2005 06:07

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

Post Reply