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

Home -> Community -> Mailing Lists -> Oracle-L -> SV: bitand functions and NUMBER(20)

SV: bitand functions and NUMBER(20)

From: Michael Garfield Sørensen - CeDeT <mgs_at_CeDeT.dk>
Date: Thu, 19 Jul 2007 22:11:50 +0200
Message-ID: <004e01c7ca41$0b0b1870$0564a8c0@CEDETA>


Hi Stefan

I think the bitand is limited to 2**63 - in SQL Developer:

select bitand(10846370260800065548,9368617832122679304) from dual;

select power(2,63) from dual;

BITAND(10846370260800065548,9368617832122679304)



9223372036854775807

1 rows selected

POWER(2,63)



9223372036854775808

1 rows selected

Something to do with bitand (still) returning a binary integer (or something other than a NUMBER) - see for example
http://www.jlcomp.demon.co.uk/faq/bitwise.html.

HTH
Michael Garfield Sørensen, CeDeT

-----Oprindelig meddelelse-----
Fra: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] På vegne af Stefan Kuhn
Sendt: 19. juli 2007 15:47
Til: oracle-l_at_freelists.org
Emne: Re: bitand functions and NUMBER(20)

On Thursday 19 July 2007 15:30, Mark W. Farnham wrote:
> I'm curious how you're establishing the value that Oracle is returning.
Hm, I assumed that 9.2234E+18 is different from 9368617832122679304, which would be 9.3686E+18. I also used Tora for the query, and it displays 9223372036854775807.
Stefan
>
> This could possibly just be a problem with the column format not being
wide
> enough for a fully expressed displayed answer.
>
> Regards,
>
> mwf
>
> -----Original Message-----
> From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]
> On Behalf Of Stefan Kuhn
> Sent: Thursday, July 19, 2007 8:18 AM
> To: oracle-l_at_freelists.org
> Subject: bitand functions and NUMBER(20)
>
> Hi all,
> I have got a column defined as NUMBER(20) and want to use bit functions on
> it.
> It seems that oracle bitand function is restricted in length. To give an
> example:
> select bitand(10846370260800065548,9368617832122679304) from TABLE;
> returns 9.2234E+18, although the second figure is a subset of bits in
first
> figure. So result should be 9368617832122679304.
> To make sure my figures are right, I did
> select 10846370260800065548 & 9368617832122679304;
> in Mysql and it gave 9368617832122679304.
> The problem does arise with figures of a certain length.
> What to do best (apart from changing the column type, which I would like
to
> avoid)?
> I hope the question isn't too trivia...
> Stefan

-- 
Stefan Kuhn BSc MA
IPB Halle
AG Bioinformatik & Massenspektrometrie
Weinberg 3
06120 Halle
http://www.ipb-halle.de http://msbi.bic-gh.de
skuhn_at_ipb-halle.de Tel. +49 (0) 345 5582 1474 Fax.+49 (0) 345 5582 1409
--
http://www.freelists.org/webpage/oracle-l



No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.9/907 - Release Date: 18-07-2007
15:30
 

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.9/907 - Release Date: 18-07-2007
15:30
 

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Jul 19 2007 - 15:11:50 CDT

Original text of this message

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