Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Bit Function
xmark.powell_at_eds.com.x wrote:
>
> In article <9bhd00$moc$1_at_news.att.net.il>, Dudi Naim <yoramn_at_cti2.com>
> writes:
> >Hi all
> >
> >How can I do bit function (like or xor and) between 2 numbers in PLSQL ?
> >
> >thanks
> >
> >yoramn_at_cti2.com
> >
> >
> I believe that the bitand function is now listed in the SQL manual. If not
> Oracle has published queries using the function in the OPS Concepts manual.
>
> Here is some code I saved off a post in the past. I have not tested it nor
> did I verify the url is still valid:
>
> 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 --
>
> ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
> http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
> NewsOne.Net prohibits users from posting spam. If this or other posts
> made through NewsOne.Net violate posting guidelines, email abuse_at_newsone.net
Yup - that's still there (although its limited to PLS_INTEGER's)
Cheers
Connor
-- =========================================== Connor McDonald http://www.oracledba.co.uk (mirrored at http://www.oradba.freeserve.co.uk) "Some days you're the pigeon, some days you're the statue"Received on Tue Apr 17 2001 - 05:46:02 CDT