Parameterized Queries

Studio can create SQL SELECT statements that include named parameters in the projections or selections. In the TDV system this feature is called a parameterized query. Such queries are implemented as single-statement SQL scripts. The SQL script code is automatically generated when you design a parameterized query with the Model and Grid panels. For details on SQL script languages, see the TDV Reference Guide.

The resources you can use in a parameterized query are tabular data and any procedure that outputs either a set of scalars or one cursor.

A parameterized query lets you include {param NAME TYPE} structures in the Grid panel to parameterize parts of the view. The resource itself is actually a SQL script with a model, so it functions like a procedure within the system.

The following sections describe how to create and execute a parameterized query:

Quick Steps for Creating a Parameterized Query
Add Input Parameters
Adding a Parameter to a SELECT Clause
Adding a Parameter to a WHERE Clause
Adding a Parameter to a FROM Clause
Executing a Parameterized Query