"invalid argument" with Array DML and TimeStamps

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jdorlon
Posts: 202
Joined: Fri 05 Jan 2007 22:07

"invalid argument" with Array DML and TimeStamps

Post by jdorlon » Mon 08 Feb 2016 16:14

Hello,

I am getting an "Invalid Argument" when I drop a TOraSQL, a TOraSession, and a TSmartQuery on a form and then try to run the following code:

Code: Select all

procedure TForm5.FormCreate(Sender: TObject);
var
  i: Integer;
  ArrayLength: Integer;
begin
  OraSession1.Username := 'JDORLON';
  OraSession1.Password := 'jdorlon';
  OraSession1.Server := 'ORCL12';
  OraSession1.LoginPrompt := False;
  OraSession1.Connect;

  SmartQuery1.sql.add('drop table ts_test');
  try
    SmartQuery1.execute;
  except
  end;
  SmartQuery1.sql.clear;
  SmartQuery1.sql.add('create table ts_test (a_ts timestamp(6))');
  SmartQuery1.execute;

  ArrayLength := 3;
  OraSQL1.ArrayLength := ArrayLength;
  OraSQL1.sql.add('insert into ts_test (a_ts) values (:Param1)');

  OraSQL1.ParamByName('Param1').DataType := ftOraTimeStamp;
  OraSQL1.ParamByName('Param1').ParamType := ptInput;
  for i := 1 to ArrayLength do
    OraSQL1.ParamByName('Param1').ItemAsTimeStamp[i].Construct(2016, 2, 8, 9, 46, 30, 1, '');
  OraSQL1.execute(ArrayLength);

  SmartQuery1.sql.clear;
  SmartQuery1.sql.add('commit');
  SmartQuery1.execute;
end;
The interesting thing is that if my Array Length is 2, it works. If I set it to 3 or more, I get the error when I get to OraSQL1.Execute. It also does not happen with other datatypes - only timestamp.

Am I doing something wrong or is this a bug?

Delphi XE2, compiling in 32 bit
Oracle Client 12.1.0.2
Oracle Server 12.1.0.2
ODAC version 9.6.22

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: "invalid argument" with Array DML and TimeStamps

Post by AlexP » Tue 09 Feb 2016 10:39

Hello,

Thank you for the sample. We have reproduce the issue and will investigate the reasons for such behavior.

jdorlon
Posts: 202
Joined: Fri 05 Jan 2007 22:07

Re: "invalid argument" with Array DML and TimeStamps

Post by jdorlon » Fri 25 Mar 2016 15:26

Hello,

It has been a while since I posted this. Do you have a solution? We are approaching a release date for our software and I hope this can be fixed before then.

Thank you
John

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: "invalid argument" with Array DML and TimeStamps

Post by AlexP » Thu 31 Mar 2016 09:59

To solve the issue, you should set the ArrayLength property after specifying the query

jdorlon
Posts: 202
Joined: Fri 05 Jan 2007 22:07

Re: "invalid argument" with Array DML and TimeStamps

Post by jdorlon » Thu 31 Mar 2016 12:36

That was unexpected! I'm glad it was so simple. By the way, I noticed that I also had to set it after setting the parameter's datatype and paramtype. Thank you.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: "invalid argument" with Array DML and TimeStamps

Post by AlexP » Thu 31 Mar 2016 12:54

You are welcome. Feel free to contact us if you have any further questions.

Post Reply