Skip to main content

convert (Function)

Converts the first input parameter according to the convertedTo parameter.

Syntax

    <INT|LONG|DOUBLE|FLOAT|STRING|BOOL> convert(<INT|LONG|DOUBLE|FLOAT|STRING|BOOL|OBJECT> to.be.converted, <STRING> converted.to)

QUERY PARAMETERS

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
to.be.convertedThis specifies the value to be converted.INT LONG DOUBLE FLOAT STRING BOOL OBJECTNoYes
converted.toA string constant parameter to which type the attribute need to be converted using one of the following strings values: int, long, float, double, string, bool.STRINGNoYes

Example 1

    insert into barStream
select convert(temp, 'double') as temp
from fooStream;

This converts fooStream temp value into double.

Example 2

    insert into barStream
select convert(temp, 'int') as temp
from fooStream;

This converts fooStream temp value into int (value = "convert(45.9, int) and returns 46.