Consultor Eletrônico



Kbase P169951: 4GL/ABL: Error (7328) executing the QUERY-PREPARE( ) method
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   15/07/2010
Status: Unverified

SYMPTOM(s):

4GL/ABL: Error (7328) executing the QUERY-PREPARE( ) method

<database name> <buffer name> <field name> must be a quoted constant or an unabbreviated, unambiguous buffer/field reference for buffers known to query <name>. (7328)

USA must be a quoted constant or an unabbreviated, unambiguous buffer/field reference for buffers known to query .(7328)

Executing code similar to the following:

DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE cCountry AS CHARACTER NO-UNDO.
DEFINE VARIABLE cPrepareString AS CHARACTER NO-UNDO.
ASSIGN
cCountry = "USA"
cPrepareString = "FOR EACH CUSTOMER NO-LOCK WHERE Customer.Country = " + cCountry.
CREATE QUERY hQuery.
hQuery:SET-BUFFERS(BUFFER Customer:handle).
hQuery:QUERY-PREPARE(cPrepareString).

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

CAUSE:

The cCountry is not quoted in the resolved query PREPARE-STRING.

FIX:

Use the QUOTER function to have the cCountry variable quoted in the resolved query PREPARE-STRING. For example, replace the cCountry expression in the offending code above with the QUOTER(cCountry) expression as per the following code:

DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
DEFINE VARIABLE cCountry AS CHARACTER NO-UNDO.
DEFINE VARIABLE cPrepareString AS CHARACTER NO-UNDO.
ASSIGN
cCountry = "USA"
cPrepareString = "FOR EACH CUSTOMER NO-LOCK WHERE Customer.Country = " + QUOTER(cCountry) .
CREATE QUERY hQuery.
hQuery:SET-BUFFERS(BUFFER Customer:handle).
hQuery:QUERY-PREPARE(cPrepareString).