SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
P-15
Example—Parameters
The data type is DATETIME if the parameter name is followed by a range of
fields and start-field-precision is not specified or if the expression has
any of these forms:
parameter-name { + | - } interval-term
interval-expression + parameter-name
date-time-expression - parameter-name
The data type is NUMERIC if the expression takes either of this forms:
parameter-name { + | - } scalar-value
{ + | - } parameter-name
Example—Parameters
In this example, you can substitute different values for the ?DEPT1 and ?DEPT2
parameters each time you execute the statement:
SELECT AVG (SALARY) FROM PERSNL.EMPLOYEE
WHERE DEPTNUM BETWEEN ?DEPT1 AND ?DEPT2;
Then you can prepare the command with the name AVGSAL and execute it like
this:
EXECUTE AVGSAL USING ?DEPT1 = 2000, ?DEPT2 = 4000;