Consultor Eletrônico



Kbase P14286: 4GL/ABL: How to copy a TEMP-TABLE to a database table while avoiding duplicate records?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/11/2009
Status: Verified

GOAL:

4GL/ABL: How to copy a TEMP-TABLE to a database table while avoiding duplicate records?

GOAL:

4GL/ABL: How to copy distinct records from a TEMP-TABLE to a database table?

GOAL:

How to use BUFFER-COPY to copy a TEMP-TABLE to a database table without duplicate records?

FACT(s) (Environment):

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

FIX:

The following code 4GL/ABL code snippet demonstrates how to copy distinct records from a TEMP-TABLE to a database table. Notice that the code to populate the source TEMP-TABLE is not included and that duplicate records from the TEMP-TABLE are not copied into the database table:

DEFINE TEMP-TABLE myTable LIKE Customer.
/***Code to populate the temp-table goes here***/
FOR EACH myTable NO-LOCK:
FIND FIRST customer WHERE customer.custnum = mytable.custnum NO-LOCK.
IF NOT AVAILABLE customer THEN DO:
CREATE customer.
BUFFER-COPY myTable TO customer.
END.
END.