xor operator

1. Junior Member
Join Date
Jan 2002
Posts
5
hi friends
can i use xor operator in oracle
i want a xor b xor c xor d

thank you

[Edited by rgharibnejad on 01-12-2002 at 06:59 AM]

2. Super Moderator
Join Date
Dec 2000
Location
Ljubljana, Slovenia
Posts
4,439
If you want to use XOR as a bit-arithmetic operator, then use function SYS.UTL_RAW.BIT_XOR.

If you want to use it as a logical operator, then you can construct one yourself.

For example, you want the result of: "a XOR b", where a and b are expresions that can result in values 0 (FALSE) or 1 (TRUE) and the result of the XOR expression should also result in values 0 (FALSE) or 1 (TRUE). You can construct your own DECODE or CASE expression that returns the XOR result - here is an example with DECODE:

DECODE(a, b, 0, 1)

Or without DECODE or CASE you can use:

MOD(a+b, 2)

[Edited by jmodic on 01-12-2002 at 03:55 PM]

Join Date
Mar 2001
Location
Posts
598
hi jmodic,

how different is SIGN() function from DECODE or CASE.
thnx,

4. Super Moderator
Join Date
Dec 2000
Location
Ljubljana, Slovenia
Posts
4,439
Originally posted by balajiyes
hi jmodic,

how different is SIGN() function from DECODE or CASE.
thnx,
I realy don't understande your question. I'm sure you know the difference between SIGN() and DECODE()/CASE, so what is your real question? To somehow construct XOR operator using solely SIGN() function? Can you explain a bit more?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•