Using TOraLoader with a Timestamp column
Using TOraLoader with a Timestamp column
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.
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:
then to fill this table with 100 rows we can use the next code:
Code: Select all
Table TimeStampTest (
StartTime TIMESTAMP(3)
)
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);