Varying-length rows for edit and validation routines
The rows of a table with varying-length columns are varying-length rows if they contain varying-length values. In basic row format, each varying-length value has a 2-byte length field in front of it. Those 2 bytes are not included in the column length attribute.
| DEPTNO | DEPTNAME | MGRNO | ADMRDEPT | LOCATION | |||
|---|---|---|---|---|---|---|---|
| C01 | 0012 | Information center | 00 | 000030 | A00 | 00 | New York |
Varying-length columns have no gaps after them. Hence, columns that appear after varying-length columns are at variable offsets in the row. To get to such a column, you must scan the columns sequentially after the first varying-length column. An empty string has a length of zero with no data following.
ROWID and indicator columns are treated like varying length columns. Row IDs are VARCHAR(17). A LOB indicator column is VARCHAR(4), and an XML indicator column is VARCHAR(6). It is stored in a base table in place of a LOB or XML column, and indicates whether the LOB or XML value for the column is null or zero length.
In reordered row format, if a table has any varying-length columns, all fixed length columns are placed at the beginning of the row, followed by the offsets to the varying length columns, followed by the values of the varying length columns.
The following table shows the same row of the sample department table, but in reordered row format. The value in the offset column indicates the offset value as a hexadecimal value.
| DEPTNO | MGRNO | ADMRDEPT | LOCATION | Offset column | DEPTNAME | ||
|---|---|---|---|---|---|---|---|
| C01 | 00 | 000030 | A00 | 00 | New York | 20 | Information center |