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

Home -> Community -> Usenet -> c.d.o.misc -> Re: bitmask comparison in a SELECT statement

Re: bitmask comparison in a SELECT statement

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Mon, 8 Mar 2004 10:00:11 +0100
Message-ID: <404c35ed$0$296$626a14ce@news.free.fr>

"NoName" <nobody_at_nowhere.com> a écrit dans le message de news:c2hbv7$672$1_at_grillo.cs.interbusiness.it...
> I can't find how to do a bitmask compare in a select.
> I explain: programmatically, if I want to know if a particular bit in a
> binary number is set, I do an "and" comparison, for example:
>
> decimal 5 = binary 101 101 and 100 = 100 (third bit is set)
> decimal 8 = binary 1000 1000 and 100 = 0 (third bit is not set)
>
> well, in a select statement, I thouth to do the same, like in this example:
>
> SELECT * from MyTable
> where (myBinaryNumber and 100) = 100
>
> ... how to write it correctly?
> Thanks
> Regards
>
>

Have a look at the BITAND function.

Regards
Michel Cadot Received on Mon Mar 08 2004 - 03:00:11 CST

Original text of this message

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