The mi_column_scale() function
The mi_column_scale() function obtains the scale of the specified column from a row descriptor.
Syntax
mi_integer mi_column_scale(row_desc, column_id)
MI_ROW_DESC *row_desc;
mi_integer column_id;
- row_desc
- A pointer to the row descriptor of the row that contains the column.
- column_id
- indicates the column identifier, which specifies the position of the column in the specified row descriptor. Column numbering follows C array-indexing conventions: the first column in the row is at position zero.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
A row descriptor can describe the
structure of a row in a table or the structure of a row type. From
the row descriptor that row_desc references, the mi_column_scale() function
obtains the scale of a column for either structure:
- The scale of the column at position column_id in the row
- The scale of the field at position column_id for the row type
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,
which end_qual represents in the following qualifier:
start_qual TO end_qual
If you call mi_column_scale() on a column or row-type field of some other data type, the function returns zero.
For more information about row descriptors 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 specified column or field is something other than DECIMAL, MONEY, FLOAT, or SMALLFLOAT.
- >0
- The scale of the specified column or field.
- MI_ERROR
- The function was not successful.