1.1

Table Of Contents
"(rooms_available - ?) WHERE hotel_id = ? " +
"AND booking_date BETWEEN ? AND ?");
-- this sample code sets the values of dynamic parameters
-- to be the values of program variables
ps2.setInt(1, numberRooms);
ps2.setInt(2, theHotel.hotelId);
ps2.setDate(3, arrival);
ps2.setDate(4, departure);
updateCount = ps2.executeUpdate();
Where Dynamic Parameters Are Allowed
You can use dynamic parameters anywhere in an expression where their data type can be easily deduced.
1. Use as the rst operand of BETWEEN is allowed if one of the second and third operands is not also a dynamic
parameter. The type of the rst operand is assumed to be the type of the non-dynamic parameter, or the union
result of their types if both are not dynamic parameters.
WHERE ? BETWEEN DATE('1996-01-01') AND ?
-- types assumed to be DATE
2. Use as the second or third operand of BETWEEN is allowed. Type is assumed to be the type of the left
operand.
WHERE DATE('1996-01-01') BETWEEN ? AND ?
-- types assumed to be DATE
3. Use as the left operand of an IN list is allowed if at least one item in the list is not itself a dynamic parameter.
Type for the left operand is assumed to be the union result of the types of the non-dynamic parameters in the
list.
WHERE ? NOT IN (?, ?, 'Santiago')
-- types assumed to be CHAR
4. Use in the values list in an IN predicate is allowed if the rst operand is not a dynamic parameter or its type
was determined in the previous rule. Type of the dynamic parameters appearing in the values list is assumed
to be the type of the left operand.
WHERE
FloatColumn
IN (?, ?, ?)
-- types assumed to be FLOAT
5. For the binary operators +, -, *, /, AND, OR, <, >, =, <>, <=, and >=, use of a dynamic parameter as one
operand but not both is permitted. Its type is taken from the other side.
WHERE ? < CURRENT_TIMESTAMP
-- type assumed to be a TIMESTAMP
6. Use in a CAST is always permitted. This gives the dynamic parameter a type.
CALL valueOf(CAST (? AS VARCHAR(10)))
vFabric SQLFire User's Guide534
vFabric SQLFire Reference