The mi_fp_setretscale() function
The mi_fp_setretscale() accessor function sets the scale of a return value of a user-defined function in its associated MI_FPARAM structure.
Syntax
void mi_fp_setretscale(fparam_ptr, ret_pos, ret_scale)
MI_FPARAM *fparam_ptr;
mi_integer ret_pos;
mi_integer ret_scale;
- fparam_ptr
- A pointer to the associated MI_FPARAM structure.
- ret_pos
- The index position into the return-scale array for the return
value whose scale you want to set. For C user-defined functions, the
only valid value is
0
. - ret_scale
- The scale, in number of digits, to set for the ret_pos+1 return value.
Valid in client LIBMI application? | Valid in user-defined routine? |
---|---|
Yes | Yes |
Usage
The mi_fp_setretscale() function sets the scale of the function return value at position ret_pos in the MI_FPARAM structure that fparam_ptr references.
The
scale is an attribute of the return-value 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
The MI_FPARAM structure stores information about the scale of function return values in the zero-based return-scale array.
For more information about return-value information in an MI_FPARAM structure or about the precision of a fixed-point data type, see the HCL OneDB™ DataBlade® API Programmer's Guide.
To
set information for the nth return value, use a ret_pos value
of n
-1
. For example, the following call to mi_fp_setretscale() sets
the scale to 4
for the first return value of the my_func() UDR,
with which fparam1 is associated: mi_integer my_func(..., fparam1)
...
MI_FPARAM *fparam1;
{
...
mi_fp_setretscale(fparam1, 0, 4);
Important: C
user-defined functions always have only one return value.
Return values
None.