ROWID function [Miscellaneous]

Function

Returns the internal row ID value for each row of the table.

Syntax

ROWID ( table-name ) ... FROM table-name

Parameters

table-name The name of the table. Specify the name of the table within the parentheses with either no quotes or with double quotes.

Examples

The following statement returns the row ID values 1 through 10:

SELECT ROWID( “PRODUCT” ) FROM PRODUCT

      rowid(product)

                                    1

                                    2

                                    3

                                    .

                                    .

                                    .

                                  10

The following statement returns the product ID and row ID value of all rows with a product ID value less than 400:

SELECT PRODUCT.ID, ROWID ( PRODUCT )
FROM PRODUCT
WHERE PRODUCT.ID < 400

           id

    rowid(product)

        300

                                  1

        301

                                  2

        302

                                  3

The following statement deletes all rows with row ID values greater than 50:

DELETE FROM PRODUCT
WHERE ROWID ( PRODUCT ) > 50

Usage

You can use the ROWID function in conjunction with other clauses to manipulate specific rows of the table.

You must specify the FROM table-name clause.

A limitation of the ROWID function is that it cannot use a join index of that table, eliminating any performance benefits that would normally use that join index.

Standards and compatibility