Previous Topic

Next Topic

Book Contents

Book Index

Using ODBC Parameters in your query

Your query can include parameters. When you use these you will be prompted for their values every time you run the query. This can be useful when setting up generic queries for saving and using later.

To include a parameter, simply code a ? where you would code a data value in your query.

Example:

Select * from TEST.DEPARTMENT where DEPTNO = ?

never put the ? inside quotes, even if it is a character value.

You can only use a parameter where you would use a data value. You cannot use it to substitute for a table or column name. For instance you cannot say Select * from ? where DEPTNO = 10

Comparison with User-Defined Parameters

Running a Query with Parameters

When you run the query, a dialog window will prompt for the Parameter description and Parameter value for each parameter.

odbc_parms

More on Parameters

Parameters are a feature provided by the ODBC Driver. Different ODBC Drivers implement parameters with varying degrees of success.

Parameter Types not available

Some databases, such as older versions of Oracle, do not provide information about the parameter types. In this case the Parameter Type will be blank and you will get the message “Your database does not report on the Type of your parameters.”

Parameter Types Inaccurate

Some databases are unable to determine the correct parameter type, so give a generic value

Load from File

If you are inserting / updating a LOB data type, a button Load from File will appear beside the parameter. Click on this to specify the file you wish to load into the LOB column (the text <aqtfile>filename will appear in the parameter value).

You will not see this button for Oracle/Access/MySQL (as these do not give accurate parameter type). For these databases you can still load the column from a file by typing <aqtfile>filename into the parameter value.

More Information

Further information on the use of parameters is given in technical discussion on parameters.

Changing the Default Values for your Parameter

When you save a query that has parameters, AQT will save default values for the parameters. These values are taken from the parameters supplied when you last ran the query. If you wish to change these default parameter values:

Advanced Query Tool
https://www.querytool.com
© 2023 Cardett Associates Ltd. All rights reserved.