BUFFER-COPY statement
- Last Updated: February 11, 2026
- 4 minute read
- OpenEdge
- Version 13.0
- Documentation
Performs a bulk copy of a source record to a target record by copying each source field to the target field of the same name. You can specify a list of fields to exclude from the bulk copy, or a list of fields to include in the bulk copy.
Syntax
|
- source
- The source database table, buffer, temp-table, or work table.
- EXCEPT field ...
- A list of space-separated source fields to exclude from the bulk copy.
- USING field ...
- A list of space-separated source fields to include in the bulk copy.
The
USINGoption is simply a positive version of theEXCEPToption. - TO target
- The target database table, buffer, temp-table, or work table.
- ASSIGN assign-expression
- A space-separated list of any valid ABL
ASSIGNstatements (without theEXCEPToption, whichBUFFER-COPYalready provides).BUFFER-COPYperforms each assign-expression and automatically excludes the field on the left side ("destination") of each assign-expression from the bulk copy-except for field extents (subscripted fields). If a field extent appears on the left side of an assign-expression,BUFFER-COPYdoes not automatically exclude that extent (such as customer.mnth-sales[1]) or the field as a whole (such as customer.mnth-sales) from the bulk copy. - NO-LOBS
- Directs the AVM to ignore large object data when copying records that contain BLOB or
CLOB fields.CAUTION: Using this option can create the potential for errors in your data and lead to inappropriate results. Therefore, before using this option, you must understand the nature of your data and be sure that logic using this option will not result in inconsistent or out-of-date data in the database.
- NO-ERROR
- The NO-ERROR option is used to prevent the statement from raising
ERRORand displaying error messages.
Note: Compound assignment operators (
+=, -=, *=, /=) can be used with the BUFFER-COPY statement. For more information, see += Addition assignment operator, -= Subtraction assignment operator, *= Multiplication assignment operator, and /= Division assignment operator.Example
The following example uses BUFFER-COPY twice. The first time, a
Customer database record is copied into a temp-table record. The second
time, the ASSIGN option is used with BUFFER-COPY to assign
the ItemName and TotalWeight fields of an
OrderLine record.
|
Notes
- At compile time,
BUFFER-COPY:- Fails to compile if any source-target field pair is not type compatible
- Excludes from the bulk copy all
EXCEPTfield fields, and all assign-expression fields on the left side of the assignment - Automatically excludes fields that appear in the source but not the target from the bulk copy
- Tries to bind unqualified field names that appear in the
EXCEPTandUSINGoptions to the source buffer
- At run time,
BUFFER-COPY:- Creates a target record if none already exists and executes any
applicable
CREATEtriggers - Assigns all matching fields that do not appear in the
EXCEPTorASSIGNoptions - Performs each assign-expression
in the
ASSIGNoption, one-by-one
- Creates a target record if none already exists and executes any
applicable
- The
BUFFER-COPYstatement, like theVALIDATEstatement, must appear within the scope of aFIND, aFOR EACH, or aCREATEstatement that references the source table. - If a
BUFFER-COPYstatement references a target buffer for the first time, ABL regards this reference as a "free reference" and scopes the buffer to the nearest enclosing block that can scope records. For more information on free references, see the topics on block properties in Develop ABL Applications. - With respect to transaction processing, ABL treats a
BUFFER-COPYstatement the same way it would treat equivalentASSIGNstatements. For more information on transaction processing, see the topics on transactions in Develop ABL Applications. - The compiler's XREF facility automatically creates a REFERENCE for each
field in the fields list, a TABLE-REFERENCE for the source and target buffers, ACCESS and
UPDATE references for any fields in the
ASSIGNoption, and ACCESS (or UPDATE) references for each source (or target) field that participates in the bulk copy. - When copying records that contain a BLOB or CLOB field, the
AVM copies the object data associated with the source record to
the target record. If the BLOB or CLOB field in the source record
contains the Unknown value (
?), the AVM stores the Unknown value (?) in the BLOB or CLOB field of the target record. If the target record already has object data associated with it, the AVM deletes that object data before copying the new object data. - Use the
NO-LOBSoption with theBUFFER-COPYstatement to ignore large object data when copying records that contain BLOB or CLOB fields. More specifically:- When you copy a source record to a new target record, the AVM sets
the value of the BLOB or CLOB field in the target record to the Unknown value (
?). - When you copy a source record to an existing target record, the AVM does not change the value of the BLOB or CLOB field in the existing target record.
You can also use the
EXCEPToption to exclude BLOB and CLOB fields from the copy. - When you copy a source record to a new target record, the AVM sets
the value of the BLOB or CLOB field in the target record to the Unknown value (