%Table meta-SQL element
Syntax
%Table(recname [, instance])
Description
The %Table construct returns the SQL table name for the record specified with recname.
For example, %Table(ABSENCE_HIST) returns PS_ABSENCE_HIST.
Note:
This meta-SQL is not implemented for COBOL.
If the record is a temporary table and the current process has a temporary table instance number assigned, %Table resolves to that instance of the temporary table (that is, PS_ABSENCE_HISTInstance Number).
You can override this
value with the instance parameter. For example, if you know you want the
third instance of a temporary table, you could specify it with %Table(&MYREC, 3). You can use the SetTempTableInstance function to set the instance
of a temporary table that is used with %Table.
This construct can be used to specify temporary tables for running parallel Application Engine processes.
Parameters
| Parameter | Description |
|---|---|
|
recname |
Identify the record that the table name is drawn from. This can be a bind variable, a record object, or a record name in the form recname. You cannot specify RECORD. recname, a record name in quotation marks, or a table name. |
|
instance |
Specify the instance of the temporary table to be used. |
Example
The following function deletes records based on two other fields:
Function delete_draft_type(&RECNAME)
&SQL = "Delete from %Table(:1) where " | FIELD.SETID | " =
:2 and " | FIELD.DRAFT_TYPE | " = :3";
SQLExec(&SQL, @("RECORD." | &RECNAME), SETID, DRAFT_TYPE);
End-Function;