Consultor Eletrônico



Kbase 20031: Error 7254 and FIND, FOR EACH, OPEN QUERY and FUNCTION call
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/10/2008
Status: Verified

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x

SYMPTOM(s):

Error: Illegal FIND, FOR EACH or OPEN QUERY in User-defined function . (7254)

Using nested selection criteria (for example, a WHERE clause inside of another WHERE clause)

Code worked fine in Progress 8.x

CHANGE:

Upgraded to Progress 9.x

CAUSE:

In Progress Version 8.x, it is possible to create a call to a user defined function similar to the following:

FUNCTION MyFunction RETURNS CHARACTER ():
   [...]
   FIND SomeTable WHERE SomeCondition = SomeValue.
   [...]
   RETURN SomeCharacterValue.
END FUNCTION.

FIND FIRST Customer WHERE Name = MyFunction() NO-LOCK NO-ERROR.

This Version 8.x behavior is considered to be a bug and Version 9.x returns Error 7254 when encountered at runtime.

FIX:

You must change your code to something similar to the following:

FUNCTION MyFunction RETURNS CHARACTER ():
   [...]
   FIND SomeTable WHERE SomeCondition = SomeValue.
   [...]
   RETURN SomeCharacterValue.
END FUNCTION.

DEFINE VARIABLE cResult AS CHARACTER NO-UNDO.

ASSIGN cResult = MyFunction().

FIND FIRST Customer WHERE Name = cResult NO-LOCK NO-ERROR.