Returns the internal row ID value for each row of the table.
ROWID ( table-name ) ... FROM table-name
table-name The name of the table. Specify the name of the table within the parentheses with either no quotes or with double quotes.
The following statement returns the row ID values 1 through 10.
SELECT ROWID( “PRODUCT” ) FROM PRODUCT
rowid(product.id) |
---|
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.id) |
---|---|
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
The ROWID function can be used in conjunction with other clauses to manipulate specific rows of the table.
The FROM table-name clause must be specified.
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.