SQL/MX Programming Manual for Java
SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java—523726-003
3-31
Host Expressions
Examples
Given the order of assignment, if the value of the index i is 1 at the time of execution,
then SQLJ uses Arry[1] and Arry[2] in the statement:
...
#sql { SELECT last_name
INTO :empname
FROM employee
WHERE jobcode = :(EmpArry[i++])
AND deptnum = :(EmpArry[i++])
};
In this example, the host expression, comp * 0.1 + comp, evaluates according to
the precedence of the arithmetic operators:
...
#sql { SELECT last_name
INTO :empname
FROM employee
WHERE salary = :(comp * 0.1 + comp)
AND deptnum = 3100
};
The order of evaluation is (comp * 0.1) + comp. Because Java defines the
multiplication operator (*) to be of a higher precedence than the addition operator (+),
the expression comp * 0.1 is evaluated first, and then the product is added to comp.