Consultor Eletrônico



Kbase P108929: How to use the EXPORT statement with a dynamic query?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/09/2005
Status: Unverified

GOAL:

How to use the EXPORT statement with a dynamic query?

FIX:

The following sample procedure demonstrates how to use the 4GL EXPORT statement in conjunction with a Dynamic Query Object to export the contents of the
the Item table to a text file "Item.d". If the table name is being passed in as an INPUT parameter or a variable, then use code along the lines of Solution P17640:
DEFINE VARIABLE hQuery AS HANDLE NO-UNDO.
CREATE QUERY hQuery.
hQuery:SET-BUFFERS((BUFFER Item:HANDLE)).
hQuery:QUERY-PREPARE("FOR EACH Item NO-LOCK").
hQuery:QUERY-OPEN().
hQuery:GET-FIRST().
OUTPUT TO Item.d.
DO WHILE hQuery:QUERY-OFF-END = FALSE:
EXPORT Item.
hQuery:GET-NEXT().
END.
OUTPUT CLOSE.