Some applications require DECIMAL types to have 15 digits or less.
Applications with this requirement may need to access DECIMAL columns that have more than 15 digits or use expressions that may produce DECIMAL results with more than 15 digits. To help with DECIMAL type size requirements, you can use CAST to convert DECIMAL types to a size of 15 or fewer digits.
For example, consider the following expression where A, B, and C are columns defined as DECIMAL(8,2):
SELECT (A*B)/C FROM table1;
The resulting value may be less than 15 digits, but A*B could be up to 18.
To ensure a result of less than 16 digits, use CAST:
SELECT CAST ((A*B)/C AS DECIMAL(15,2)) FROM table1;