### static expression

Using Static Expressions with Conditional Compilation defines the kind of expression you can use with conditional compilation...

I got one question on forums.oracle.com today, an user wanted to use bitand and could not.

I wrote my answer but, ... , the site is down and eventually my answer did not get accepted.

So, to translate bitand(x,y)=z, using static expression, when x<8 and y<8 and z<8, then

quite big, but this is evaluated only once, at compilation time, so it should be an acceptable workaround in some case !

I got one question on forums.oracle.com today, an user wanted to use bitand and could not.

I wrote my answer but, ... , the site is down and eventually my answer did not get accepted.

So, to translate bitand(x,y)=z, using static expression, when x<8 and y<8 and z<8, then

`(`

(

(x=0) or

(y=0) or

(x=1 and (y=2 or y=4 or y=6)) or

(x=2 and (y=1 or y=3 or y=5 or y=7)) or

(x=3 and y=4) or

(x=4 and (y=1 or y=2 or y=3)) or

(x=5 and y=2) or

(x=6 and y=1)

) and z=0

) or (

(

(x=1 and (y=1 or y=3 or y=5 or y=7)) or

(x=3 and (y=1 or y=5)) or

(x=5 and (y=1 or y=3)) or

(x=7 and y=1)

) and z=1

) or (

(

(x=2 and (y=2 or y=3 or y=6 or y=7)) or

(x=3 and (y=2 or y=6)) or

(x=6 and (y=2 or y=3)) or

(x=7 and (y=2))

) and z=2

) or (

(

(x=3 and (y=3 or y=7)) or

(x=7 and y=3)

) and z=3

) or (

(

(x=4 and (y=4 or y=5 or y=6 or y=7)) or

(x=5 and (y=4 or y=6)) or

(x=6 and (y=4 or y=5)) or

(x=7 and y=4)

) and z=4

) or (

(

(x=5 and (y=5 or y=7)) or

(x=7 and y=5)

) and z=5

) or (

(

(x=6 and (y=6 or y=7)) or

(x=7 and y=6)

) and z=6

) or (

x=7 and y=7 and z=7

)

quite big, but this is evaluated only once, at compilation time, so it should be an acceptable workaround in some case !

## 2 Comments:

Hi,

What is the benefit of this? I can't understand!

if you use conditional compilation (10gR2 new feature), it is not possible to use functions like BITAND or GREATEST nor operator like + or -.

The way above is a way of rewritting bitand(x,y)=z using static expression

The benefit of using conditional compilation is hudge :

add debugging info which will help in developement and will not slow down in the production and the code will not change

Post a Comment

<< Home