Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Bitwise Operator

TaralAug 30 2010 — edited Aug 30 2010
Hi Gurus,

I am bit poor at math and yes i know bitand is used for binary and operation. But i can't figure out this conversion.

Here is a flag column values from ts$
 flags   0x40 = COMPRESS 
         0x10000 = OLTP Compression 
         0x20000 = Columnar Low Compression
         0x40000 = Columnar High Compression
         0x80000 = Archive Compression
And here is corrosponding conversion in dba_tablespaces script.

case when bitand(ts.flags,  65536) = 65536  then 'OLTP'
                  when bitand(ts.flags, (131072+262144)) = 131072
                    then 'QUERY LOW'
                  when bitand(ts.flags, (131072+262144)) = 262144
                    then 'QUERY HIGH'
                  when bitand(ts.flags, (131072+262144)) = (131072+262144)
                    then 'ARCHIVE LOW'
                  when bitand(ts.flags, 524288) = 524288
                    then 'ARCHIVE HIGH'
                  else 'BASIC' end))
Now, here are my question

1. 0x40 & 0x10000 and othere are hexa values Right ?
2. So what does 65536 means here all other values are multiple (131072) are of this
3. So, what are we checking here with this kind of bitand(ts.flags, (131072+262144)) thing

Can someone please explain in simple terms. I searched manuals and other but they give just high level information but not basic.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2010
Added on Aug 30 2010
2 comments
807 views