Page 1 of 1

"invalid argument" with Array DML and TimeStamps

Posted: Mon 08 Feb 2016 16:14
by jdorlon
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

Re: "invalid argument" with Array DML and TimeStamps

Posted: Tue 09 Feb 2016 10:39
by AlexP
Hello,

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

Re: "invalid argument" with Array DML and TimeStamps

Posted: Fri 25 Mar 2016 15:26
by jdorlon
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

Re: "invalid argument" with Array DML and TimeStamps

Posted: Thu 31 Mar 2016 09:59
by AlexP
To solve the issue, you should set the ArrayLength property after specifying the query

Re: "invalid argument" with Array DML and TimeStamps

Posted: Thu 31 Mar 2016 12:36
by jdorlon
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.

Re: "invalid argument" with Array DML and TimeStamps

Posted: Thu 31 Mar 2016 12:54
by AlexP
You are welcome. Feel free to contact us if you have any further questions.