Consultor Eletrônico



Kbase P52158: Getting 8826 only for some records when using nested FOR statements
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/14/2008
Status: Verified

SYMPTOM(s):

Getting 8826 only for some records when using nested FOR statements

Error 8826 with nested FOR EACH statements using FIELDS list

Getting 8826 only for some records

Field <field-name> from <file-name> record (recid <RECID>) was missing from FIELDS phrase. (8826)

Referring to fields that are not contained in the FIELDS clause

The following code is a sample of this query:

FOR EACH customer FIELDS (customer.country) NO-LOCK:
FOR FIRST order FIELDS (order-date) WHERE order.cust-num = customer.cust-num NO-LOCK:
DISP order.order-date.
END.
END.

FACT(s) (Environment):

Error message is also written to the database log file on behalf of the client
Progress 9.x
OpenEdge 10.x
All Supported Operating Systems

CAUSE:

This is expected behavior.
Fields required to resolve the inner FOR statement are missing in the FIELDS list for the outer FOR statement. As a result, there is no guarantee that the field values will be available; when it is not available the error occurs.

FIX:



Always include all fields referenced in the field list option of the record phrase.
Do not rely on Progress to always provide such extra fields, fields are only included implicitly if the database engine uses them to resolve a single specific query.