Skip to Content

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.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. sreedhara sameer kumar ilapavuluri

    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

    (0) 

Leave a Reply