Re: Is there a bitfield type field in oracle?



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...
.



Relevant Pages

  • Re: Teaching Oracle PL/SQL class
    ... PL/SQL is used in industry. ... Common Uses? ... Tight Integration with SQL / Higher Productivity ... Subtopics ...
    (comp.databases.oracle.server)
  • Re: Teaching Oracle PL/SQL class
    ... I am teaching an Oracle PL/SQL class. ... Common Uses? ... Tight Integration with SQL / Higher Productivity ... Parameterized Cursors ...
    (comp.databases.oracle.server)
  • Re: Teaching Oracle PL/SQL class
    ... I am teaching an Oracle PL/SQL class. ... Common Uses? ... Tight Integration with SQL / Higher Productivity ... Parameterized Cursors ...
    (comp.databases.oracle.server)
  • Teaching Oracle PL/SQL class
    ... I am teaching an Oracle PL/SQL class. ... Common Uses? ... Tight Integration with SQL / Higher Productivity ... Parameterized Cursors ...
    (comp.databases.oracle.server)
  • Re: Tested 11g OLTP compression and found rather serious issue
    ... I ran the below script in a series of 11g OLTP compression tests. ... SQL> -- Create an ASSM tablespace with small extent size for testing ... SQL> create table c2 compress for all operations tablespace t1 as ...
    (comp.databases.oracle.server)