SQL Variables and Expressions

The syntax for using a SQL variable in an expression is


For example, to retrieve the values in the PRICE column in the table referenced by the link template HOUSES, enter &PRICE@HOUSES.

To relate a second table to the table specified in the link template and return a value from one of its fields, use this syntax

&[ [ [catalog. ] schema. ] colname@LT [.lnka1, lnka2, ..., lnkaN [.lnkb1, lnkb2, ..., lnkbN ] ]

The expression must be entered on one line.

SQL Expressions and SQL Statements

The expression:

&catalog.schema.table.colname @linktemplate.lnka1,lnka2,...,lnkaN.lnkb1,lnkb2,...,lnkbN

is equivalent to the following SQL statement:

SELECT catalog.schema.table.colname FROM catalog.schema.table WHERE lnka1 = lnkb1 AND lnka2 = lnkb2 AND ... AND lnkaN = lnkbN AND linktemplatekey1 = linktemplatevalue1 AND linktemplatekey2 = linktemplatevalue2 AND ... AND linktemplatekeyN = linktemplatevalueN

where lnka1,...,lnkaN are columns from the primary table, lnkb1,...,lnkbN are columns from the secondary table, linktemplatekey1,...,linktemplatekeyN are link template key columns from the primary table, and linktemplatevalue1,...,linktemplatevalueN are the key column values obtained from the object.