Previous Next

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 OpenEdge 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 ABL meta-schema files.
Syntax 
 
ROWID ( record )
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.
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.
 
DEFINE VARIABLE response AS LOGICAL NO-UNDO.
DEFINE VARIABLE crowid   AS ROWID   NO-UNDO.
 
REPEAT:
  PROMPT-FOR Customer.CustNum.
  FIND Customer USING Customer.CustNum NO-LOCK.
  crowid = ROWID(Customer).
  DISPLAY Customer.Name.
  response = YES.
  UPDATE response LABEL "Update CreditLimit ?".
  IF response THEN DO:
    FIND Customer WHERE ROWID(Customer) = crowid EXCLUSIVE-LOCK.
    UPDATE Customer.CreditLimit.
  END.
END.
Notes 
*
*
*
*
*
*
*
*
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.
 
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 */
See also 
DEFINE BUFFER statement, DEFINE VARIABLE statement, RECID function, Record phrase, REPOSITION statement, STRING function, TO-ROWID function

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.