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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL and bitwise logic with numbers

Re: SQL and bitwise logic with numbers

From: Jurij Modic <jurij.modic_at_mf.sigov.mail.si>
Date: Thu, 11 Jun 1998 11:13:07 GMT
Message-ID: <357f8fcf.7759103@www.sigov.si>


On 10 Jun 1998 18:14:29 GMT, "Kári Poulsen" <kapo_at_utvarp.olivant.fo> wrote:

>I have this funny feeling that I'm just missing something here...
>
>I'm trying to make simple numeric logic operations in sql, such as "10 AND
>2", the ususal stuff that any programming language supports (AND, OR, XOR ,
>NOT)
>
>Is it just me, or does this really not exist in sql?

In Oracle's SQL there is an (undocumented!?) function BITAND that performs binary AND operation on integers. Look in $ORACLE_HOME/rdbms/admin/standard.sql. Example:

        1101 AND 0111 = 0101 (13 AND 7 = 5) SQL> SELECT BITAND(13,7) FROM dual;

B
-
5

>And if not, there's bound to be some package out there that does..

In Oracle's SQL there is only AND operator, there is no such thing as OR or XOR. However there is supplied PL/SQL package UTL_RAW, where you'll find functions like: BIT_AND, BIT_OR, BIT_XOR, BIT_COMPLEMENT. Look into $ORACLE_HOME/rdbms/admin/utlraw.sql for more informations.

>thanks for your time.
>
>pls. email also to kapo_at_utvarp.olivant.fo
>
>regards
> Kári Poulsen

Regards,


Jurij Modic                             Republic of Slovenia
jurij.modic_at_mf.sigov.mail.si		Ministry of Finance
============================================================
The above opinions are mine and do not represent any official standpoints of my employer Received on Thu Jun 11 1998 - 06:13:07 CDT

Original text of this message

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