Symbols in creating queries to JDBC or ODBC data sources
You can use symbols (variables) in custom SQL queries to JDBC- or ODBC-compliant data sources. The reason you would add a symbol to a custom SQL query is to build a filtered link (using the Link Wizard) to the workspace with a table or chart that uses this query. For example, if you are building a link based on the data source attribute for system name, the symbol might be $myhostname$.
When you apply the query to a table or chart, you will be prompted to enter a value for the variable as soon as you click Apply or OK. The value filters the data that will show in the view, but is temporary and cannot be saved with the workspace.
- Use a one-word name surrounded by dollar signs, as in
$mysymbol$
, where mysymbol is the symbol name. - When the link is launched, a symbol is resolved to a value enclosed
in single quotation marks if it is anything other than an integer.
An integer resolves without the quotation marks. If you are referencing
the symbol in a custom SQL statement and you do not want the quotation
marks included in the resolved value, add a pound sign after the first
dollar sign, as in
$#noquotation s$
, where noquotation s is the symbol name. This notation is required for numeric data types.Example:
The value of theSELECT * FROM MYTABLE WHERE MYCOLUMN = $#myNumber$
$#myNumber$
symbol is a number (such as 5 or 345).