Use the TABLE form
- Last Updated: January 16, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
When you pass a static temp-table between two routines, you can use the
INPUT
TABLE, INPUT-OUTPUT TABLE, and OUTPUT
TABLE forms you learned about earlier. To review them, in the
RUN statement in the calling program, you define a temp-table
parameter in this way:
|
In the routine that is called, you define the table as a parameter in this way for an
INPUT or INPUT-OUTPUT parameter:
|
For an
OUTPUT temp-table parameter returned from a called routine, you
use this syntax:
|
Remember that you must include a compatible static definition of the temp-table on both sides of the call. This means that at least the number and data types of fields must match in the two table definitions.
What happens when you pass a temp-table in this way? The AVM packages up a description of
the table and its fields and indexes, along with all the data in all the rows of the
temp-table, and marshals it in a single stream from one routine to the other. This means
that the temp-table is copied into the routine on the OUTPUT side of
the call. To understand the implications of this, consider the two basic ways in which
one routine can call another.