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 operators and binary data

Re: Bitwise operators and binary data

From: arale <araleNOarSPAM_at_utok.com.invalid>
Date: Thu, 10 Feb 2000 07:36:31 -0800
Message-ID: <00c9c2a0.fdc6072c@usw-ex0102-083.remarq.com>


There are no functions that deal with binary operators, but you can do it by yourself.
like

   function bit_test(n in number, p in number) return number is

   begin

     if mod(trunc(n/power(2,p)),2)=1 then
        return 1;
     else
        return 0;
     end if;

   end;

and you can use it like:
select field1 [,field2....] from table
where bit_test(your field,place)=1;

place is the bit you want to check that is set to 1. (starting from 0)

Hope it helped you,
for further details/questions you can find me at uTOK (www.uTOK.com) and join the oracle group.

Received on Thu Feb 10 2000 - 09:36:31 CST

Original text of this message

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