TO_DECIMAL
Description
TO_DECIMAL
is a row function that converts Text
,
Boolean
, Integer
, Long
,
Double
, or Numeric
values to
Numeric
values with the default number of digits before and after
the decimal point.Syntax
TO_DECIMAL
(expression
)Return Value
Returns one value per row of type
Numeric
with the default number of
digits before and after the decimal point.Input Parameters
- expression
- Required. A field or expression of typeText(must be numeric characters),Boolean,Integer,Long,Double, orNumeric.
Examples
Convert the values of the
average_rating
field to a Numeric field type:TO_DECIMAL([average_rating])
Convert the
average_rating
field to a Numeric field type, but first transform the
occurrence of any NA
values to NULL
values using a CASE
expression:TO_DECIMAL(CASE WHEN [average_rating]="N/A" then NULL ELSE [average_rating]
END)