The mi_parameter_scale() function
The mi_parameter_scale() function returns the scale of the column that is associated with a specified input parameter in a prepared statement.
Syntax
mi_integer mi_parameter_scale(stmt_desc, param_id)
MI_STATEMENT *stmt_desc;
mi_integer param_id;
- stmt_desc
- A pointer to the statement descriptor for the prepared statement that contains the input parameter.
- param_id
- The parameter identifier of the column, which specifies the position
of the input parameter in the specified statement descriptor. Input-parameter
numbering follows C programming conventions: the first parameter in
the statement is at position zero.
Valid in client LIBMI application? Valid in user-defined routine? Yes Yes
Usage
The mi_parameter_scale() function
obtains the column scale of the column that is associated with param_id from
the statement descriptor that stmt_desc references. This function
is an accessor function for a statement descriptor, which describes
a prepared statement. The statement descriptor stores information
about the scales of input-parameter columns in the zero-based parameter-scale
array. To obtain information about the nth input parameter,
use a param_id value of n-1
.
Data type | Meaning of scale |
---|---|
DECIMAL (fixed-point), MONEY | The number of digits to the right of the decimal point |
DECIMAL (floating-point) | The value 255 |
DATETIME, INTERVAL | The encoded integer value for the end qualifier
of the data type; end_qual in the qualifier: start_qual TO end_qual |
If you call mi_parameter_scale() on some other data type, the function returns zero.
- UPDATE with or without a WHERE clause
- UPDATE WHERE CURRENT OF
If you attempt to request parameter information for other SQL statements, mi_parameter_scale() raises an exception.
For more information about input parameters or about the scale of a fixed-point data type, see the HCL OneDB™ DataBlade® API Programmer's Guide.
Return values
- 0
- The data type of the column associated with the specified input parameter is something other than DECIMAL or MONEY.
- >0
- The scale of the DECIMAL or MONEY column that is associated with the specified input parameter.
- MI_ERROR
- The function was not successful.