MIN_SCALE

Purpose

This function returns the minimum scale needed to represent the value exactly. This is equivalent to the number of fractional decimal digits in the value excluding trailing zeroes.

Syntax

min_scale::=

Usage Notes

The argument must be an exact numeric type. The return type is DECIMAL(2, 0).

Example

SELECT MIN_SCALE(123.00000) S1,
       MIN_SCALE(9.99999999999) S2,
       MIN_SCALE(-0.0045600) S3;
S1 S2 S3
0 11 5