Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: decimal to binary masks
You can use bitand function:
v734> declare
2 foo number := 3;
3 begin
4 if bitand(foo,2) = 2 then
5 dbms_output.put_line('bit 2 set');
6 else
7 dbms_output.put_line('bit 2 clear');
8 end if;
9 end;
10 /
bit 2 set
PL/SQL procedure successfully completed.
--
Have a nice day
Michel
Steve A <spectre_at_hkstar.com> a écrit dans le message :
1e5qhum.1116aws1u15z3gN@[192.168.2.50]...
> Hi,
> I want to test for a given bit being set.
> for example a number field being used as flag storage.
> 0=no lock
> 1=invoiced_locked
> 2=shipping_locked
> 4=packing_locked
> etc
>
> if bitset(flag,2)
> then
> .....
> else
> XXXXX
> endif
>
> I don't want to have to use UTL_RAW, since it seems to only work on
> varchar2 & rawtypes
>
> any routines out there
>
>
> steve
>
Received on Wed Feb 09 2000 - 03:19:54 CST
![]() |
![]() |