Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : Database Access : Fetching records : ROWID and RECID data types : Storing and retrieving ROWID and RECID values
 
Storing and retrieving ROWID and RECID values
As shown in the previous example, you can store ROWID values in ROWID variables. You can also store them in work table fields. Thus, the following are valid ROWID storage definitions:
DEFINE VARIABLE wkrid AS ROWID NO-UNDO EXTENT 20.

DEFINE WORK-TABLE wtrid
  FIELD wkrid AS ROWID.
You cannot store ROWID values in database or temporary tables, but you can store their hexadecimal string representations using the STRING function. You can then retrieve the string as a ROWID value using the TO–ROWID function:
DEFINE TEMP-TABLE ttRid NO-UNDO
  FIELD ridfld AS CHARACTER.

FOR EACH Customer WHERE Customer.Balance = 0 NO-LOCK:
  CREATE ttRid.
  ASSIGN ttRid.ridfld = STRING(ROWID(Customer)).
END.

DO TRANSACTION:
  FOR EACH ttRid:
    FIND Customer WHERE ROWID(Customer) = TO-ROWID(ttRid.ridfld).
    DELETE Customer.
  END.
END.
You can store RECID values directly in a database or temporary table.