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: Differences between Oracle RDBMS and MS SQL Server

Re: Differences between Oracle RDBMS and MS SQL Server

From: Mark D Powell <markp7832_at_my-deja.com>
Date: Wed, 06 Dec 2000 13:58:17 GMT
Message-ID: <90lgln$6dc$1@nnrp1.deja.com>

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;

BEGIN
FOR i IN 1 .. 32 LOOP
  IF ( bitand(l_x,l_tmp) = l_tmp OR
       bitand(l_y,l_tmp) = l_tmp ) THEN
       l_r := l_r + l_tmp;

  END IF;
  l_tmp := l_tmp * 2;
  exit when ( l_tmp >= l_x AND l_tmp >= l_y ); END LOOP; RETURN l_r;
END;
/

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

Original text of this message

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