ROWID function
- Last Updated: February 11, 2026
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Returns the unique internal identifier of the database record currently associated with the record buffer you name. This internal identifier has the data type ROWID, which is supported for OpenEdge and all other DataServer databases.
ROWID function corresponds to the ROWID attribute.This function replaces the RECID function for most applications. However, you must use the RECID function for maintaining schema objects (file and field relationships) in the ABL meta-schema files.
Syntax
|
- record
- The name of the record whose
ROWIDyou want.To use the
ROWIDfunction with a record in a table defined for multiple databases, you must qualify the record's table name with the database name. See the record definition in the Record phrase reference entry for more information.
Example
You might decide that you do not want to lock a record until the user
starts to update that record. In the example procedure, the FIND statement
reads a Customer record without locking the record. The ROWID function puts
the internal database identifier of that record in the crowid variable. If the user decides to update the CreditLimit field, the procedure finds the record again using the value in
crowid. The second FIND statement reads
the record again, this time placing an EXCLUSIVE-LOCK on it. Because the
record is first found with NO-LOCK, it is possible for the record to be
updated by another user after the first FIND and before the second.
r-rowid.p
|
Notes
- Use the
ROWIDfunction to rapidly retrieve a previously identified record, even if that record has no unique index. - The
ROWIDdata type is a variable-length byte string capable of representing a record identifier for any DataServer database. However, the scope of a specificROWIDreturned by theROWIDfunction depends on the DataServer and possibly the table within a database. TheROWIDvalues for some DataServers change whenever the corresponding record is modified. For others, aROWIDvalue can change when a particular column in a table is modified. For more information on how different DataServers derive and work withROWIDvalues, see the OpenEdge DataServer Guides (Use the Microsoft SQL Data Server and Use the Oracle Data Server). - You cannot return a
ROWIDfor a view because view records do not have unique identifiers. - You can compare
ROWIDvalues using the ABL relational operators (=, >, <, <>, >=, and <=), such as in theWHEREoption of the Record phrase. - You can use a
ROWIDvalue in aREPOSITIONstatement to specify the new position for a query cursor. - If you want a called procedure to use the same record as a calling
procedure, use the
ROWIDfunction to ensure that you are retrieving the same record. Use aSHARED ROWIDvariable or procedure parameter to communicate theROWIDof a record from one procedure to another. The second procedure can then find the same record. This is an alternative to using shared buffers or buffer parameters. - You can store a
ROWIDvalue in a work table or temp-table, but not directly in a database table. - You can use the
STRINGfunction to convert aROWIDvalue to a character string, and convert it back to aROWIDvalue using theTO-ROWIDfunction. - You do not have to explicitly check to see whether a record is
AVAILABLEbefore using theROWIDfunction. TheROWIDfunction returns the Unknown value (?) if a record cannot be accessed.This example checks the
ROWIDfor each Customer record returned for a query to determine if another record exists to update. If no more records exist, the update loop (QuickFix) terminates.OPEN QUERY qCustomer FOR EACH Customer WHERE Customer.Balance > 5000 AND Customer.Balance < 6000. QuickFix: REPEAT: GET NEXT qCustomer. IF ROWID(Customer) = ? THEN LEAVE QuickFix. ELSE UPDATE Customer. END. /* QuickFix */ - The
ROWIDof a record in a partitioned table identifies both the partition and the address of the record in the partition. If a partition field is updated in the record and, as a result, the record is moved to a different partition, the record'sROWIDwill change.
See also
DEFINE BUFFER statement, DEFINE VARIABLE statement, RECID function, Record phrase, REPOSITION statement, STRING function, TO-ROWID function, ROWID attribute, VAR statement