Progress
Language Reference
ROWID Function
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 Progress and all other DataServer databases.
NOTE: 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 Progress metaschema files. For more information, see the Progress Programming Handbook .SYNTAX
record
The name of the record whose ROWID you want.
To use the ROWID function 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 Phrase reference entry for more information.
EXAMPLEYou 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 credit-limit 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.
NOTES
- Use the ROWID function to rapidly retrieve a previously identified record, even if that record has no unique index.
- The ROWID data type is a variable-length byte string capable of representing a record identifier for any DataServer database. However, the scope of a specific ROWID returned by the ROWID function depends on the DataServer and possibly the table within a database. The ROWID values for some DataServers change whenever the corresponding record is modified. For others, a ROWID value can change when a particular column in a table is modified. For more information on how different DataServers derive and work with ROWID values, see the Progress DataServer Guides , Progress DataServer for ODBC Guide and Progress DataServer for ORACLE Guide.
- You cannot return a ROWID for a view because view records do not have unique identifiers.
- You can compare ROWID values using the Progress relational operators (=, >, <, <>, >=, and <=), such as in the WHERE option of the Record phrase.
- You can use a ROWID value in a REPOSITION statement 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 ROWID function to ensure that you are retrieving the same record. Use a SHARED ROWID variable or procedure parameter to communicate the ROWID of 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 ROWID value in a work table, but not directly in a temporary table or database table. You can use the STRING function to convert a ROWID value to a character string, which you can store in a temporary or database table, and convert it back to a ROWID value using the TO-ROWID function.
- You do not have to explicitly check to see whether a record is AVAILABLE before using the ROWID function. The ROWID function returns the unknown value (?) if a record cannot be accessed.
This example checks the ROWID for 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.
SEE ALSO
DEFINE BUFFER Statement, DEFINE VARIABLE Statement, RECID Function, Record Phrase, REPOSITION Statement, STRING Function, TO-ROWID Function
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |