Progress
Programming
Handbook
Temporary Tables As Parameters
Temporary table parameters strongly resemble other parameters, but have a few differences. This section discusses the similarities and differences.
Similarities
Temporary table parameters resemble other procedure parameters in several ways:
- In the calling procedure, you define the parameter type as INPUT, OUTPUT, or INPUT–OUTPUT. INPUT is the default. Here is the syntax for a defining a temporary table parameter in the calling procedure’s RUN statement.
NOTE: For information on the APPEND option, see the last item in the "Differences" section.
- In the called procedure, you define the parameter type as INPUT, OUTPUT, or INPUT–OUTPUT. INPUT is the default. Here is the syntax for defining a temporary table parameter in the called procedure’s DEFINE PARAMETER statement.
NOTE: For information on the APPEND option, see the "Differences" section.
- The parameter types (INPUT, OUTPUT, or INPUT–OUTPUT) you define in the calling procedure and the called procedure must match.
- Data moves between the calling procedure and the called procedure depending on the parameter type. INPUT parameter data moves from the calling procedure to the called procedure, OUTPUT parameter data moves from the called procedure to the calling procedure, and INPUT–OUTPUT parameter data moves from the calling procedure to the called procedure, then back to the calling procedure. Some parameters send data, and others receive data. Table 15–3 identifies which parameters send data and which receive data, based on parameter type (INPUT, OUTPUT, or INPUT–OUTPUT) and role (calling procedure or called procedure).
- Data moves between the parameters of the calling procedure and the parameters of the called procedure at precise times. INPUT parameter data moves just before the called procedure begins to execute. OUTPUT parameter data moves just after the called procedure’s RETURN statement executes. INPUT–OUTPUT parameter data moves like input parameter data, then like output parameter data.
- You can only use the APPEND option for an INPUT parameter in the calling procedure or an OUTPUT parameter in the called procedure.
Differences
The following special rules apply to temporary table parameters:
NOTE: If the calling procedure and the called procedure use the same shared or global temporary table as a parameter (which might occur when code is automatically generated), then no data moves, and using the APPEND option (even when the compiler allows it) causes a run time error.- The calling procedure and the called procedure must have separate temporary tables.
- The signatures of the two temporary tables must match. This means that the calling procedure’s temporary table and the called procedure’s temporary table must match with respect to the number of columns, the data type of each column, and the number of extents of each column (for columns with extents).
- The calling procedure’s temporary table and the called procedure’s temporary table need not have matching indexes.
- Progress does not automatically convert data between “similar” data types, such as integer and decimal.
- At data movement time, Progress overlays any existing data in the receiving temporary table (OUTPUT and INPUT–OUTPUT parameters in the calling procedure, and INPUT and INPUT–OUTPUT parameters in the called procedure) — unless you define the receiving temporary table with the APPEND option. If you use the APPEND option, Progress appends the incoming data to the existing data.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |