Re: Is there a bitfield type field in oracle?
Date: Wed, 30 Jan 2008 09:58:22 -0800 (PST)
Message-ID: <0571a8d1-1264-4f8b-ad90-a005ef561614@s37g2000prg.googlegroups.com>
> > 3) Is there a bitmap-kind of field that could hold one entry in a bit
> > of an integer type. Such things are available to software developers
> > who need to compress the data as much as possible.
> I was going to write how this would not work, because although there
> are bit manipulation functions in PL/SQL you would need a 365 bit
> number (366 for leap years), and I thought this would be out of range.
>
> But then I tried it, and it worked:
>
> SQL> select bitand(power(2, 366), 1) from dual;
>
> BITAND(POWER(2,366),1)
> ----------------------
> 1
>
> Well, no exception anyway... But the answer is wrong. It should be
> 0. Weird. I chalk this up to a floating point inaccuracy.
Seems to silently give the wrong answer at 2^63. I'm using 64 bit Oracle.
SQL> select bitand(power(2, 63), 1) from dual;
BITAND(POWER(2,63),1)
1
SQL> select bitand(power(2, 62), 1) from dual;
BITAND(POWER(2,62),1)
0
I think that's pretty crap. It should throw an overflow exception... Received on Wed Jan 30 2008 - 11:58:22 CST