Page 1 of 1

Bug of parameter of type AsArray.

Posted: Mon 11 Aug 2008 12:03
by Mic777
Hello.

In Oracle objects are created:

Code: Select all

create or replace
  type FoundESNRecord AS OBJECT (
    ID_ESNI  INTEGER,
    VData   varchar2(2000))

create or replace
  type FoundESNIdTable AS TABLE OF FoundESNRecord
In Delphi the form on which are placed TButton, TOraSession, TOraQuery is created.

In handler events OnClick of object TButton the code contains:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var IndexRecord,
    IndexArray: integer;
begin
  TempQuery.Close;
  TempQuery.SQL.Text := 'Select * ' +
    'From table( cast( :p_FoundESNIdTable as FoundESNIdTable ))';
  TempQuery.ParamByName( 'p_FoundESNIdTable' ).AsArray.AllocObject(TempQuery.Session.OCISvcCtx, 'FoundESNIdTable');

  with TempQuery.ParamByName( 'p_FoundESNIdTable' ).AsArray do
  begin
    for IndexRecord := 1 to 10 do
    begin
      IndexArray := AppendItem;
      ItemAsObject[IndexArray].AttrAsLargeInt[ 'ID_ESNI' ] := IndexRecord;
    end;
  end;
  TempQuery.Open;
  ShowMessage('RecordCount: ' + inttostr(TempQuery.RecordCount) );
end;
By the first pressing the button I receive the message
" RecordCount: 0 ".
At the subsequent - RecordCount: 10 (as well as should be).

It is a bug or I do something incorrectly?

It is shown up for versions ODAC 6.50.0.35 and 6.50.0.36.

Best regards.
Michael.

As yet I have solved the given problem so...

Posted: Tue 12 Aug 2008 08:06
by Mic777

Code: Select all

TempQuery.Close;
TempQuery.SQL.Text := 'Select * ' +
  'From table( cast( :p_FoundESNIdTable as FoundESNIdTable ))';  TempQuery.ParamByName( 'p_FoundESNIdTable' ).AsTable.AllocObject(TempQuery.Session.OCISvcCtx, 'FoundESNIdTable');

TempQuery.SQL.Text := TempQuery.SQL.Text; // !!! I redefine the text of inquiry and that's all there's to it.

Posted: Tue 12 Aug 2008 12:37
by Plash
We have fixed this problem. The fix will be included in the next build of ODAC.

The problem is in the IsNull property of the parameter. As a workaround you can use the following code to make the IsNull property False:

Code: Select all

TempQuery.ParamByName( 'p_FoundESNIdTable' ).Value := 'A';