Try OpenEdge Now
skip to main content
DataServer for Oracle
Initial Programming Considerations : ABL issues : ROWID function
 

ROWID function

The ROWID data type provides a record identifier that is compatible across OpenEdge and Oracle databases. Applications that use the ROWID function behave the same way whether they access ABL or Oracle records.
Note: The default external representation of ROWID enables the Oracle Dataserver to use a 64-bit integer value for ROWID. Using an integer value to define ROWID is not required, but rather an option to efficiently represent ROWID as a numeric binary value. The Oracle DataServer supports the NUBER data type to emulate ROWID expansion.
By default, the DataServer designates a column to support the ROWID function. It evaluates the indexes available for a table and selects one in the following order:
1. PROGRESS_RECID column
2. Unique index on a single, mandatory, NUMBER column with precision < 10 or undefined and scale 0 or undefined
3. Native ROWID
Oracle might not provide a native ROWID for views that contain aggregates or perform joins. For one of these views to support the ROWID function, use the Data Dictionary to select a NUMBER column, create a unique index based on it, and designate it as the ROWID.
The Data Dictionary allows you to select a different column to support the ROWID function or to select the native ROWID. See Defining the ROWID for instructions about changing how a table supports ROWID.
The native ROWID typically provides the fastest access to a record. However, the native ROWID does not support ABL's FIND PREV/LAST statement or cursor repositioning. FIND FIRST/NEXT statements for tables that use the native ROWID as a row identifier have unpredictable results. Qualify the FIND FIRST statement with the USE-INDEX option, as in the following example, to get consistent results across various data sources, as shown:
FIND FIRST customer USE-INDEX custnum.
ROWID provides the same functionality as the RECID function, but ROWID is more consistent across data sources. Replace the RECID function with ROWID in existing applications.
Follow these guidelines when using ROWID in applications that you want to deploy across several databases:
*Do not try to get the ROWID value before the user assigns values to the unique keys of that record. Some DataServers use the unique key to generate a ROWID value.
*Refresh the ROWID value if a value of a unique key might have changed.
*Refresh the ROWID value after you undo a DELETE. The ROWID value might be different after the record is re-created.
*ROWID values are stable for a transaction. Do not rely on them being the same across transactions or sessions.
Note: Reposition functions such as REPOSITION-BACKWARDS and REPOSITION-TO-ROW typically use ROWID to identify records. Functions of this type require integer expressions, which can be either INTEGER or INT64.
See the ROWID function entry in OpenEdge Development: ABL Reference for more information and examples.