Parameterized SQL Queries in the Proficy Portal
Parameters are used within the Proficy Real Time Information Portal to build SQL queries that can be reused with different values. In the place of a constant value in a SQL query, you can instead place a parameter, which takes a value at execution time. Parameterized SQL queries are driven by Proficy Real Time Information Portal components such as list boxes, combo boxes or grids.
Parameterized queries are built in the Proficy Real Time Information Portal SQL Query Builder application. You can define a parameter by entering the name of the parameter in the Parameter field of the Specify Selected Item Wizard or the Specify Criterion Wizard. When you enter a name, the Statement Builder adds a question mark to the end of the name and encloses the entire string in curly brackets. For example, the parameter temperature
becomes {temperature?}
.
You also have the option to select a data type for the parameter. The data type determines the kind of data the parameter can hold. By default, the data type is set to char
. However, you can select int
, date
, num
, or char
as the type of database column.
When you define a parameter in the SQL Statement Builder, you can specify a default value for the parameter from the Parameters tab.
Parameter names must be unique. You cannot create multiple parameters with the same name. Consult your Proficy Real Time Information Portal documentation for more information.