BODS – Expression value data type, typecast
Expression value data type
example-1: decode(1<>1,2,1.23), this evaluates to 1
example-2: decode(1<>1,2.0,1.23) this evaluates to 1.23
example-3: decode(1=1,2.1,1) this evaluates to 2.1
What is happening here?
BODS will cast from left to right, i.e. what ever the datatype of the left most operand is the final datatype of the expression.
in example 1 first operand is 1, entire expression castes/converts to INTEGER
in example 2 first operand is a floting point, entire expression casts/converts to a float/double
in example 3 first operand is a floting point, entire expression casts/converts to a float/double
This issue is applicable where ever a mathematical expression is possible like in query transform, lookup etc.