# xor operator

• 01-12-2002, 04:28 AM
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]
• 01-12-2002, 03:49 PM
jmodic
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]
• 01-13-2002, 02:12 AM
balajiyes
hi jmodic,

how different is SIGN() function from DECODE or CASE.
thnx,
• 01-13-2002, 07:54 AM
jmodic
Quote:

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?