Re: Bit-manipulate SP's ?
Posted in 1998
Hi Dirk,
I'm sorry, I don't know if it is the same for SE, but try something
like:
create procedure IsBitSet
(i_val INT, i_bitnr SMALLINT)
returning SMALLINT;
if mod(i_val,pow(2,i_bitnr+1)) >= pow(2,i_bitnr) then
return 1;
else
return 0;
end if;
end procedure;
Hope this helps,
Guenther
Dirk Niemeier wrote:
> Hi,
> had anyone written some SP's to test/manipulate single bits in an
> numeric column ?
> I'm loocking for someting like : IsBitSet(<int>, <bit-number>) or
> SetBit(<int>, <bit-number>).
> If possible for SE-Database.
>
> regards
> Dirk Niemeier
-------------------
akm software GmbH http://www.akm.de
Guenther Schmid schmid@akm.de
Hochaeckerstr. 108 Tel.: (49) 89 / 678 207 - 44
D-81737 Muenchen Fax: (49) 89 / 678 207 - 50