16. Table Fields : The Data Set : A Sample Table Field
 
Share this page                  
A Sample Table Field
The examples in the remainder of this chapter all use the same form and database tables. The empform form, shown in the following figure, has one table field, employee, and two simple fields, department and floor. The table field has four displayed rows and two displayed columns, with the internal names of ename and age. The titles of the columns are Name and Age.
Two database tables are used in the application, employee and department. They have the following descriptions:
exec sql declare employee table
     (eno   integer2  not null,
      ename  char(20)  not null,
      age    integer1  not null,
      sal    float4  not null,
      dept   char(10)  not null);
 exec sql declare department table
     (dept   char(10)  not null,
      floor   integer1  not null);
Also, it is assumed that the examples all contain the following host variable declarations:
exec sql begin declare section;
     eno       integer;
     ename     character_string(20);
     age       integer;
     sal       float;
     dept      character_string(10);
     floor     integer;
     state     integer;
     record    integer;
     msgbuf    character_string(80);
exec sql end declare section;
Where other variables are needed, their declarations are given in the example.