Consultor Eletrônico



Kbase P13261: Unique FIND using BEGINS doesn't return error 3166 as expected.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/12/2006
Status: Verified

FACT(s) (Environment):

Progress 8.x
Progress 9.x
OpenEdge 10.x

SYMPTOM(s):

Using FIND <table> WHERE <field> BEGINS ...

Multiple records exist matching the BEGINS string

Only one record in the table is an exact match for the BEGINS string

The field referenced by the BEGINS is in an index

Error 3166 is not raised

More than one <table> records found by a unique FIND. (3166)

FIND FIRST with BEGINS returns expected results

FOR EACH with BEGINS returns expected results

CAUSE:

This is expected behavior.

The FIND will not check for further ambiguity if there is only one index entry exactly matching the BEGINS criteria.
This was implemented in one of the earlier Progress versions due to customer demand, most customers wanted the FIND to return them a record if at all possible.

FIX:

Workaround:
Replace 'BEGINS' with GT + 'MATCHES'.

The GT is required for performance reasons, since it uses indexes where "MATCHES" does not.