Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Bitwise & operator - Oracle 8i - Std server - How do you do it ?

Re: Bitwise & operator - Oracle 8i - Std server - How do you do it ?

From: Daniel A. Morgan <Daniel.Morgan_at_attws.com>
Date: Tue, 17 Jul 2001 11:52:49 -0700
Message-ID: <3B548981.62B77040@attws.com>

CME wrote:

> Dear all,
>
> I am trying to write a bitwise and operator to check a flag we store in an
> Number (using Oracle Std Server 8i).
>
> I have looked through the help and the only support I can find is for RAW
> datatypes:
>
> UTL_RAW.BIT_AND(x,y)
>
> Also there is a section on Bit Operators (converting from SQL / Sybase) and
> it states writing a package, which is a great idea....
>
> However how do you write a function / procedure to do a bitwise & ?
>
> Any help would be gratefully accepted.
>
> Thanks
>
> Matt.

Take a good look at the operator's Oracle has used in creating data dictionary objects such as all_tables. What you will see is code that looks like this:

decode(bitand(t.property, 1024), 0, null, co.name),
       decode(bitand(t.property, 512), 0, null, co.name),
       decode(bitand(t.property, 32), 0, mod(t.pctfree$, 100), null),
       decode(bitand(t.property, 32+64), 0, t.pctused$, 64, 0, null),
       decode(bitand(t.property, 32), 0, t.initrans, null),
       decode(bitand(t.property, 32), 0, t.maxtrans, null),

which makes me wonder whether you are trying to reinvent the wheel?

Daniel A. Morgan Received on Tue Jul 17 2001 - 13:52:49 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US