Re: Bit mask an index

From: Jarkko Siitonen <Jarkko.Siitonen_at_dialogos.fi>
Date: Mon, 21 Sep 1998 14:37:26 +0300
Message-ID: <6u5g1d$klf_at_inet-server.sit.fi>


Patrick Janidlo wrote in message ...
>Just a newbie question.
>
>I want to be able to mask off an index to see if a bit is on, from within a
>select statement. For example, a mask of 0x1 would return the indexes of
1,
>3, 5, 7, 9, etc. but not 2, 4, 6, 8, etc.
>
>Is this possible in Oracle 8.0.4?
>
I ended up doing something similar in Oracle 7.3 with modulo (MOD) and pragma restricted PL/SQL function. Modulo is handy for breaking a number into bits - but it is still way too complicated to do boolean algebra. Anyways i did something like this:

  IF MOD(iNumber,POWER(2,iBit)) >= POWER(2,iBit-1)   THEN

  • The bit is 1 END IF;
Any suggestion how to do boolean algebra with integers in PL/SQL?

Jarkko Received on Mon Sep 21 1998 - 13:37:26 CEST

Original text of this message