Skip to Content
Author's profile photo Former Member

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.

Assigned tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Sir.


      I believe there was a typo in your statement. in example 1 first operand is 1, entire expression castes/converts to INTEGER


      Shouldn't be like this: in example 1 first operand is 1    2, entire expression castes/converts to INTEGER


      Regards,

      Sree