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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: BITAND need help (Solved)

Re: BITAND need help (Solved)

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 15 Mar 2002 01:33:28 -0800
Message-ID: <F001.0042A67D.20020315013328@fatcity.com>

The reason behind the oddity is probably that bitand() is defined (see standard.sql) to return a binary_integer (it used to return a number in earlier versions) and pure SQL does not recognise that type, so you need a method for coercing the result to a number.

It is probably slightly cheaper (though the point is moot) to use:

    to_number(bitand(x,y))
or cast(bitand(x,y) as number)
rather than invoking division.

More significantly, your post has highlighted an error I made a couple of days ago in a discussion about x$bh and tablescans.

I wrote:

    to_number(bitand(flag, power(2,19))) = 1 this should have been:

    to_number(bitand(flag, power(2,19))) = power(2,19)

(Of course, the answer I was looking for WAS
a 1, I'd just put it in the wrong place ;)

Apologies for any confusion I caused.

Jonathan Lewis
http://www.jlcomp.demon.co.uk

Next Seminar - UK, April 3rd - 5th
http://www.jlcomp.demon.co.uk/seminar.html

Host to The Co-Operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html

Author of:
Practical Oracle 8i: Building Efficient Databases

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jonathan Lewis
  INET: jonathan_at_jlcomp.demon.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).
Received on Fri Mar 15 2002 - 03:33:28 CST

Original text of this message

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