Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: binary operators in PL/SQL

Re: binary operators in PL/SQL

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Wed, 15 Sep 1999 10:44:46 +0200
Message-ID: <7rnmb7$5eb$1@oceanite.cybercable.fr>


You can use bitand function:

v734>declare
  2 myvalue integer;
  3 begin

  4     for myvalue in 1..10 loop
  5         if ( bitand(myvalue,2) = 2 ) then
  6             dbms_output.put_line ('my value='||myvalue||' - Bit 1 set');
  7         else
  8            dbms_output.put_line ('my value='||myvalue||' - Bit 1 clear');
  9         end if;
 10     end loop;

 11 end;
 12 /
my value=1 - Bit 1 clear
my value=2 - Bit 1 set
my value=3 - Bit 1 set
my value=4 - Bit 1 clear
my value=5 - Bit 1 clear
my value=6 - Bit 1 set
my value=7 - Bit 1 set
my value=8 - Bit 1 clear
my value=9 - Bit 1 clear
my value=10 - Bit 1 set

PL/SQL procedure successfully completed.

CadWeb a écrit dans le message <7rndci$kv5$1_at_wanadoo.fr>...
>In visual Basic I can do
>
>IF (myvalue AND 2) = 2 THEN ....
>
>in TransactSQL
> IF (myvalue & 2 ) = 2 ..
>
>with myvalue is an integer
>
>but how I can do that in PL/SQL I have read the doc but I can't find this
>
>Thank you
>
>Alain Mistral
>
>please respond to :
>a.mistral_at_pytheas.com
>
>
Received on Wed Sep 15 1999 - 03:44:46 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US