Bitwise operations


There is an undocumented 'bitand()' routine you can call, to do logical AND on two numbers. If you need the others, a little boolean math should suffice

CREATE OR replace FUNCTION bitor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER  AS
BEGIN
    RETURN x + y - bitand(x,y);
END;
/

CREATE OR replace FUNCTION bitxor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER  AS
BEGIN
    RETURN bitor(x,y) - bitand(x,y);
END;
/

These functions are callable from SQL as well. Since this is all based on the PLS_INTEGER datatype, you are limited to numbers less than 2^31.