#1 2013-05-30 13:03:26

peak.tibor
Member
Registered: 2013-02-22
Posts: 19

Oracle interface fails if number of parameters is more then 94

I think it is a Mormot framework bug, as I know Oracle itself does not have this limit.
I receive the following error message when trying to use more than 94 params: ORA-01745:invalid host/bind variable name.

Here the code I use to test the situation:
It runs OK if num_of_fields=94, fails if 95 or greater.



  num_of_fields := 95;

  SQL := 'drop table insdemo ';
  Statement := props.NewThreadSafeStatement;
  Statement.Prepare(SQL,False);
  Statement.ExecutePrepared;
  Statement.Free;

  SQL := 'create table insdemo (';
  for I := 1 to num_of_fields do if i=num_of_fields then SQL := SQL + 'a' + FormatFloat('000',i) + ' varchar2(100))'
                                                    else SQL := SQL + 'a' + FormatFloat('000',i) + ' varchar2(100),';

  Statement := props.NewThreadSafeStatement;
  Statement.Prepare(SQL,False);
  Statement.ExecutePrepared;
  j := Statement.UpdateCount;
  Statement.Free;
  Memo1.Lines.Add('create j: ' + IntToStr(j));

  SQL := 'insert into insdemo values(';
  for I := 1 to num_of_fields do if i=num_of_fields then SQL := SQL + '?)' else SQL := SQL + '?,';

  Memo1.Lines.Add('Sql command to execute: ' + SQL);

  Statement := props.NewThreadSafeStatement;
  Statement.Prepare(SQL,False);

  for i := 1 To num_of_fields Do Statement.BindTexts(i,'b' + FormatFloat('000',i));

  Statement.ExecutePrepared;
  Statement.Free;

Offline

Board footer

Powered by FluxBB