Example - Selecting an object

Top  Previous  Next

次のサンプルはPersonsオブジェクトテーブルからaddressオブジェクト属性を選択し、nullかどうかテストし、そしてaddressCity属性を表示します。

var Address: TOracleObject;

begin

   Query.SQL.Text := 'select Name, Address from Persons';

   Query.Execute;

   while not Query.Eof do

   begin

     Address := Query.ObjField('Address');

     if not Address.IsNull then

       ShowMessage(Query.Field('Name') + ' lives in ' + Address.GetAttr('City'));

     Query.Next;

   end;

end;