Consultor Eletrônico



Kbase P45240: Expecting error 3166 from FIND unique with BEGINS.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/01/2006
Status: Unverified

FACT(s) (Environment):

Progress 9.1D

SYMPTOM(s):

Expecting error 3166 from FIND unique with BEGINS.

FIND customer WHERE name BEGINS "XYZ" returns no error when there is an index on name and name field perfectly matches "XYZ".

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

FIND FIRST .... will find the first record satisfying the criteria in the WHERE/OF/USING phrases. FIND ... without the FIRST keyword is a unique find, and requires that there be ONLY ONE record that satisfies the criteria given.

CAUSE:

Expected behaviour.

FIX:

That's it. A FIND with BEGINS returns a record if:
1. FIND uses a index
2. there is perfect match for BEGINS phrase

To determine ambiguity use one of the following method :
- FOR EACH with a counter or SELECT COUNT(*) ... INTO ...
- MATCHES instead of BEGINS
- drop the index