Was this helpful?
Query Targets
The target of a select query can be of any Ingres data type, a field or variable, form, table field column or row, record, record attribute, array or array record attribute. When a query fetches one of these, values can be assigned directly to it.
The following example assigns one value from dbexpr into the col column of the current row of the tbl_fld table field:
form = select :tbl_fld.col = dbexpr from dbtable
You can assign values to any of a displayed row's columns by using a row reference. For example:
tbl_fld2 ] = select col = dbexpr from dbtable ;
arrayi ] = select * from dbtable ;
The data types of the target object and the database column from which the data is selected must be compatible. If they have the same name, do not specify fieldname.
Use the reserved word all in place of the target list in any select statement to assign values to all the simple fields in a form or to all the visible columns of a table field. Each field or column in the form must correspond to a database column with the same name and data type. The database can contain columns that do not match those in the form, but the form cannot contain unmatched simple fields or table field columns. Append the reserved word all to the tablename, as shown below:
form := select tablename.all
You can also use the asterisk (*) in any select statement to assign values to all the visible simple fields of a form or to all the visible columns of a table field, or to all the attributes of a record or array record. The asterisk replaces the list of column names, as shown below:
deptform := select * from deptable;
4GL recognizes complex components, including arrays and record types, in most contexts where it recognizes forms and table fields. Like forms and table fields, they cannot be assigned or compared directly in any way. This also means that complex components can be query targets. For example:
record = select * from desc where ... ;
Selection into a complex data component is similar to selecting into table fields in that the data is cleared (default values are displayed) before the query is executed. This is different from form selects, which do not change the values of any fields not specified in the target list.
See Selecting into Records in Selecting into Table Fields for information on selecting into a record without clearing the current values.
Last modified date: 04/03/2024