TABLE-HANDLE form with BY-REFERENCE
- Last Updated: May 26, 2026
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
To pass a
TABLE-HANDLE by reference, use this syntax for the
RUN statement in the calling routine:
|
The called routine defines the parameter using ordinary
TABLE-HANDLE
parameter syntax, with no BY-REFERENCE keyword:
|
BY-REFERENCE appears only on the calling
RUN statement, not on the parameter definition. (The
BIND keyword, in contrast, must appear on both sides. See TABLE-HANDLE form with BIND.)Note: If the called routine’s temp-table is a static temp-table, you
can save the overhead of instantiating it by defining it as
REFERENCE-ONLY:
|
Example
In the following sample code, ProcA.p builds a dynamic
temp-table at run time, runs ProcB.p persistently, then passes
the temp-table handle to ProcB's addRecords
internal procedure using the BY-REFERENCE keyword. Because the
table is passed by reference, the AVM shares the caller's instance instead of
copying its definition and data. ProcB.p adds records directly to
the caller's temp-table through the handle. ProcA.p then reads
those records back through the same instance using a dynamic query.
Note:
BY-REFERENCE must be specified on every
RUN statement that passes the parameter. If you omit it, the
AVM makes an implicit copy of the temp-table instead of sharing the instance. If you
need the sharing to persist for the life of a persistent procedure without repeating
the keyword on each call, use BIND instead. See TABLE-HANDLE form with BIND.| ProcA.p (caller) |
|---|
|
| ProcB.p (callee) |
|---|
|