Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Differences between Oracle RDBMS and MS SQL Server
In article <MPG.14977d0552cfb4f19896aa_at_news.bitstream.net>,
tdkannel_at_bitstream.net (Tim Kannel) wrote:
> warning: slightly off-topic...
>
> > Currently it does not have bitwise comparison (?) However with
functions
> > and now with Oracle's object classes on could develop you own. I am
not
> > sure if there is a great need for this feature. Where does one
use/need
> > a bitwise operator? I really cannot think of a specific case.
>
> Could you provide more details on this?
>
> The company that I work for is currently porting SQL server databases
> to Oracle (due to a customer requirement, not because we want to).
> It could make porting easier if we could add bitwise operators in a
way
> that would be transparent to the queries that use them.
>
> --
> Tim Kannel
> TCAP 3.1 - Captures console I/O to a file
> ftp://ftp.simtel.net/pub/simtelnet/msdos/sysutl/tcap31.zip
>
1) You should be happy you are moving to Oracle; it is a much more
robust rdbms though it is much more complicated as it provides you the
DBA a great deal of influence through the init.ora, hints, and other
features.
Oracle has at least one bit manipulation function, bitand. You can use it to build others. Here is some code I have captured off of previous posts but have not had time to test.
CREATE OR replace FUNCTION bitor( x IN NUMBER, y IN NUMBER ) RETURN NUMBER AS
l_x PLS_INTEGER DEFAULT x; l_y PLS_INTEGER DEFAULT y; l_r PLS_INTEGER DEFAULT 0; l_tmp PLS_INTEGER := 1;
IF ( bitand(l_x,l_tmp) = l_tmp OR bitand(l_y,l_tmp) = l_tmp ) THEN l_r := l_r + l_tmp;
http://www.oradba.freeserve.co.uk/tips/bitwise_ops.htm
CREATE OR replace FUNCTION bitor( x IN NUMBER, y IN NUMBER ) RETURN
NUMBER AS
BEGIN
RETURN x + y - bitand(x,y);
END;
/
CREATE OR replace FUNCTION bitxor( x IN NUMBER, y IN NUMBER ) RETURN
NUMBER AS
BEGIN
RETURN bitor(x,y) - bitand(x,y);
END;
/
-- Mark D. Powell -- The only advice that counts is the advice that you follow so follow your own advice -- Sent via Deja.com http://www.deja.com/ Before you buy.Received on Wed Dec 06 2000 - 07:58:17 CST