CAST

Casts the input expression to the specified type.

Syntax

CAST(<expression> AS <type>) 

Example

Transformation job example

SQL

In the the following example, the nettotal column, which is a double, is converted to a string to enable it to be concatenated with the dollar symbol:

CREATE JOB cast_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
  MAP_COLUMNS_BY_NAME 
    SELECT  orderid,
            '$' || CAST(nettotal AS STRING) AS nettotal,
            orderdate
    FROM    default_glue_catalog.upsolver_samples.orders_raw_data
    LIMIT   3;

Query result

orderidnettotalorderdate

cU1QEyPKKc

$2018.37

2023-07-24T15:54:00Z

6eI2KeIc2A

$1842.35

2023-07-24T15:54:00Z

yRQUXyRPTP

$1144.7

2023-07-24T15:54:00Z

Last updated