A pseudo-column is a column automatically associated by CA IDMS with each table or view. Pseudo-columns are not part of the definition of a table or a view and thus do not show up as rows from the SYSTEM.COLUMN catalog table, nor will they be part of a SELECT * list.
ROWID has a special data type TID (Tuple ID) with a fixed length of 8 bytes. For any practical considerations, the TID data type can be considered equivalent to BIN(8). The ROWID contains information about the storage location of the row in the database. Internally the ROWID is made up of the DBKEY of the underlying database record (first 4 bytes). The last 4 bytes are currently ignored, but may be used in the future.
The value of ROWID is unique for each row of a base table; however, you cannot consider it to be a table's primary key because its value can change over the lifetime of the database. This could happen, for example, after an UNLOAD/RELOAD operation.
The ROWID provides unique access and the fastest access to a row of a table, no matter if the table is SQL- or non-SQL-defined.
The ROWID value is not persistent for the life of the database, but it never changes within a transaction or other controlled processes, if the row is not deleted, of course.
The value of ROWID can be null (for example, as the result of an outer join operation).
A ROWID pseudo-column cannot be updated or inserted.
Views also have an associated ROWID pseudo-column. The value of a view's ROWID is the ROWID of the first base table in the decomposition of the view from left to right. The ROWID values of a view are not necessarily unique.
The ROWID pseudo-column is a CA IDMS extension of the SQL standard.
Although ROWID can be used for SQL-defined tables, it is most useful for updating non-SQL-defined databases. Since such databases tend to have record types with no primary or foreign keys, identifying a specific row to be updated or deleted is often difficult. For such record types, it was often necessary to implement a table procedure to perform the update or deletion. The presence of ROWID pseudo-column makes the table procedure unnecessary, because it uniquely identifies each row of any non-SQL-defined table.
|
Copyright © 2014 CA.
All rights reserved.
|
|