16. Table Fields : Table Field Row States : Setting Row States
 
Share this page                  
Setting Row States
When a row is placed into the data set, using either the loadtable or insertrow statement, by default, that row's state is UNCHANGED. To set the row state differently, specify the _state constant in the argument list of the statement, assigning it the desired state. You can also use the putrow statement to change a row's state (note that only certain states are allowed, based on the current state -- for more information on the putrow statement, see Forms Statements). You can specify _state as an integer literal or an integer variable.
For example, the following insertrow statement inserts a row into the table field and assigns it a NEW state:
exec frs insertrow deptform emp_table
     (ename = :name, esalary = :salary, _state = 1);
You can specify any legal _state value except DELETED. The legal values and their corresponding states are:
0--UNDEFINED
1--NEW
2--UNCHANGED
3--CHANGED
If you specify an UNDEFINED state, do not specify values for any visible columns in the row, because, by definition, an UNDEFINED row is a row that is empty. If you try to do so, you receive a runtime warning but Ingres assigns the values to the visible columns. Ingres generates the warning because the existence of data in an UNDEFINED row can cause problems when you use _state to decide which type of database update to perform during an unloadtable or getrow. You can, however, assign values to hidden columns regardless of the state assigned to the row.
Note:  Derived values in UNDEFINED rows are displayed if it is possible to calculate them.