First page Back Continue Last page Graphics

Using Named Bind Variables


Using Named Bind Variables

Named bind variables enable developers to assign logical names to SQL query parameters, set minimum, maximum, and default values, and to reuse and reorder the parameters at will. Named bind variables can be assigned values in the Business Component Browser.

To use a named bind variable, perform the following steps:

1. On the Overview tab of the view object editor, select the SQL category, and then under Bind Variables click Create.

2. In the Bind Variables dialog box, you specify the name, data type, and optionally a default value. You can name the variables as you like, but because they share the same namespace as view object attributes, you need to choose names that do not conflict with existing view object attribute names. The Updatable check box determines whether the value can be changed; by default, a nonupdatable named bind variable has no setter method generated for it and no methods are exposed to the client. You can click the other tabs in the dialog box to specify custom properties and UI control hints if desired.

3. After defining the bind variables, the next step is to reference them in the SQL statement in either the SELECT list or the WHERE clause.

4. When you run the Business Component Browser, a Bind Variables dialog box enables you to specify a value for the bind variables. You can also change or set this value in the toolbar.