Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Bitwise operators and binary data
I'm not sure I follow, does this function work on binary data? It seems it would only work on numbers, which would more naturally be handled with &.
arale <araleNOarSPAM_at_utok.com.invalid> writes:
> 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.
>
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
> The fastest and easiest way to search and participate in Usenet - Free!
>
--
greg
Received on Thu Feb 10 2000 - 11:52:21 CST