DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: xor operator

  1. #1
    Join Date
    Jan 2002
    Posts
    5
    hi friends
    can i use xor operator in oracle
    i want a xor b xor c xor d
    please help me

    thank you

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

  2. #2
    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]
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    hi jmodic,

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

  4. #4
    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?
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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


Click Here to Expand Forum to Full Width