Input parameters

Acts as placeholders to allow end-users to supply values to a prepared statement. These user-supplied values are then used to execute the statement.

Syntax
{ ? | :name [ : indicator-name ]  }
Remarks

Use the placeholder character of ? or the named form in expressions. You can use input parameters whenever you can use a column name or constant.

The precise mechanism used to supply the values to the statement are dependent upon the API you use to create your UltraLite client.

Using the named form   The named form of an input parameter has special meaning. In general, name is always used to specify multiple locations where an actual value is supplied.

For embedded SQL applications only, the indicator-name supplies the variable into which the null indicator is placed. If you use the named form with the other components, indicator-name is ignored.

Deducing data types   The data type of the input parameter is deduced when the statement is prepared from one of the following patterns:

  • CAST ( ? AS type )

    In this case, type is a database type specification such as CHAR(32).

  • Exactly one operand of a binary operator is an input parameter. The type is deduced to be the type of the operand.

If the type cannot be deduced, UltraLite generates an error. For example:

  • -?: the operand is unary.

  • ? + ?: both are input parameters.

See also
Example

The following embedded SQL statement has two input parameters:

INSERT INTO MyTable VALUES ( :v1, :v2, :v1);

The first instance of v1 supplies its value to both the v2 and v1 locations in the statement.