For batch-mode AQT, User-defined Parameters are always enabled.
For online AQT, User-defined Parameters are (by default) not enabled. You can enable this by selecting Enable Parameters in the Parameters dialog. Click on OK. This setting is saved between sessions, so you only have to do this once.
On the Parameters window, you can specify whether parameters are to be indicated with a $ or a colon. This is done with the Indicate parameters with option. By default, this will be a $. The only choices are $ or colon.
You can avoid this by having fuller names for parameters - for example: custname, custcode, custid, custcountry etc rather than just cust.
If Options > General > Remember user-parms between sessions is selected, AQT will save the parameter values between sessions.
The file they are saved in is parms.txt in your Default Directory. The parms are saved whenever AQT shuts down successfully, or when OK is clicked on the User-Defined Parameters window.
Parameters are often used when running batch scripts. Any changes to parameters done during batch scripts are not saved.
A parameter can reference parameter.
Example:
Parameter |
Value |
date07 |
2007-03-31 |
date08 |
2008-03-31 |
rundate |
$date07 |
In this, the value of rundate is the name of another parameter.
When you specify:
select * from accounts where transaction_date > '$rundate'
the following will be run:
select * from accounts where transaction_date > '2007-03-31'
Using the function Parameters > Show SQL after parameter replacement is useful for seeing how parameters will be resolved.
You can delete parameters with the delparm statement. You might wish to do this at the start of a batch script. Examples:
--aqt delparm,parm=custcode
(deletes a single parameter)
--aqt delparm,parm=*cust*
(deletes all parms containing cust)
--aqt delparm,parm=*
(deletes all parameters)