This function prompts the user for the values of User-Defined Parameters. The following parameters are available:
The name of the parameter.
The display-name for the parameter. When the user is queried for the parameter-value, Desc is used to describe the parameter. Desc is optional and, if not specified, the same value as Parm will be used.
If the parameter is non-display field, code pwd=y
. When the parameter is entered by the user it is displayed as asterixes. You would use this option when prompting for a password to be entered.
The Pwd parameter is not supported when a dropdown list is used (see the next section).
This allows you to specify either:
The Select parameter is discussed later.
The value the parameter will be set to. If not specified, it will take the existing value of the parameter.
The values you can code here are the same as for Setparm. In addition, if you have specified a dropdown list, you can specify a value of <n>. The parameter will be set to the nth value from the dropdown list.
Once you define parameters (with either queryparm
or setparm
), AQT will scan all subsequent statements for reference to the parameters. Parameters are referred to by preceding the parameter name with a $
.
Example 1:
--aqt queryparm,parm=sdate,desc=Start Date
select * from order_details where order_date > '$sdate'
Example 2:
--aqt queryparm,parm=userid,desc=Userid,parm=pwd,desc=Password,pwd=y
--aqt connect,dbs=sample,user=$userid,pwd=$pwd
See the file batch_parms.sql
, which is
deployed with AQT, for more examples of the use of parameters.
Restrictions
This allows you to specify:
To specify a date picker, code one of:
select=date
select=time
select=timestamp
To specify a drop down list, specify either:
select=(
comma-separated list of values)
The values should be enclosed in double-quotes if they contain any special characters such as commas, spaces or brackets.
select=(
select statement)
The select statement is run to populate the drop-down list.
Examples:
--aqt queryparm,parm=sdate,desc="Start Date",select=date,value=<date>
--aqt queryparm,parm=type,desc=Type,select=(T,P,S),value=T
--aqt queryparm,parm=order,desc="Order Number",select=(select distinct order_number from order_details),value=<1>