Kbase P109662: FIND-UNIQUE method fails to find records by rowid
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  06/10/2005 |
|
Status: Unverified
FACT(s) (Environment):
OpenEdge 10.x
SYMPTOM(s):
FIND-UNIQUE method fails with error 138
Trying to find record by ROWID
ROWID to find is valid
ROWID is supplied in where clause as quoted string representation in the predicate expression
** <file-name> record not on file. (138)
CAUSE:
This is expected behavior.
The quoted string is not being cast to a ROWID datatype automatically. This is not caught because for performance reasons the error checking when executing the FIND-UNIQUE method is kept at a minimum.
FIX:
Use the FIND-BY-ROWID method instead of FIND-UNIQUE when fetching records by ROWID. FIND-BY-ROWID is optimized for this specific purpose and is therefore the preferred method.
Alternatively, modify the predicate expression to explicitly cast the ROWID string representation to the ROWID datatype.
For example:
BUFFER myBuffer:FIND-UNIQUE("where rowid(myBuffer) = " + QUOTER(STRING(ROWID(myOtherBuffer))) ).
Would become:
BUFFER myBuffer:FIND-UNIQUE("where rowid(myBuffer) = to-rowid(" + QUOTER(STRING(ROWID(myOtherBuffer))) + ")" ).