DECIMAL_SCALE function - Amazon Redshift

Amazon Redshift will no longer support the creation of new Python UDFs starting Patch 198. Existing Python UDFs will continue to function until June 30, 2026. For more information, see the blog post .

DECIMAL_SCALE function

Checks the number of decimal digits to be stored to the right of the decimal point. The range of the scale is from 0 to the precision point, with a default of 0.

Syntax

DECIMAL_SCALE(super_expression)

Arguments

super_expression

A SUPER expression or column.

Return type

INTEGER

Examples

To apply the DECIMAL_SCALE function to the table t, use the following example.

CREATE TABLE t(s SUPER); INSERT INTO t VALUES (3.14159); SELECT DECIMAL_SCALE(s) FROM t; +---------------+ | decimal_scale | +---------------+ | 5 | +---------------+