The mi_type_scale() function

The mi_type_scale() function obtains the scale of the data type from its type descriptor.

Syntax

mi_integer mi_type_scale(type_desc)
   MI_TYPE_DESC *type_desc;
type_desc
A pointer to the type descriptor from which to obtain the scale.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_type_scale() function obtains the data type scale from the type descriptor that type_desc references. The scale is an attribute of the data type. The meaning of the scale depends on the associated data type, as the following list shows.
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_type_scale() on some other data type, the function returns zero.

For information about type-descriptor accessor functions or on precision and scale, see the HCL OneDB™ DataBlade® API Programmer's Guide.

Return values

>=0
The scale of the data type in type_desc.
MI_ERROR
The function was not successful.