DB2 12 - Data types - ROWID data type


Volta a página anterior

Volta ao Menu Principal


Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

DB2 12 - Data types - ROWID data type

You use the ROWID data type to uniquely identify rows in a Db2® subsystem.

Db2 can generate a value for the column when a row is added, depending on the option that you choose (GENERATED ALWAYS or GENERATED BY DEFAULT) when you define the column.

You can use a ROWID column in a table for several reasons.

  • You can define a ROWID column to include LOB data in a table.
  • You can use direct-row access so that Db2 accesses a row directly through the ROWID column.
    If an application selects a row from a table that contains a ROWID column, the row ID value implicitly contains the location of the row.
    If you use that row ID value in the search condition of subsequent SELECT statements, Db2 might be able to navigate directly to the row.

    Requirement: To use direct row access, you must use a retrieved ROWID value before you commit.
    When your application commits, it releases its claim on the table space.
    After the commit, if a REORG is run on your table space, the physical location of the rows might change.

  • You can define a ROWID column with the IMPLICITLY HIDDEN attribute.
    Such columns are returned only for SQL statements that explicitly name the column.
    SQL statements that only imply selection of the column, such as statements that specify SELECT *, do not return the column.

© Copyright IBM Corp.