Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    69

    Unanswered: Bitwise NOT in Oracle

    We have bitwise operators in SQL Server. For example Bitwise AND is &. Bitwise NOT is ~.

    I know there is a function called BITAND in Oracle equivalent for &. But is there an equivalent for Bitwise NOT (~) in Oracle ? If not, how can we achieve the logic ?

  2. #2
    Join Date
    Apr 2004
    Posts
    69
    Looked at utl_raw package and found

    utl_raw.bit_complement(utl_raw.cast_to_raw(number_ var));

    But then how to convert this raw back to a number ?

  3. #3
    Join Date
    Apr 2004
    Posts
    69
    Never mind ! I tried this and it worked :

    function bitnot(p_dec1 number) return number is
    begin
    return (0 - p_dec1) - 1;
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •