Oracle Not Equals Operator

前端 未结 6 1302
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-18 15:41

There are two not equals operator - != and <>.

What\'s the difference between them? I heard that != is more efficient than

相关标签:
6条回答
  • 2021-02-18 16:19

    The difference is :

    "If you use !=, it returns sub-second. If you use <>, it takes 7 seconds to return. Both return the right answer."

    Oracle not equals (!=) SQL operator

    Regards

    0 讨论(0)
  • 2021-02-18 16:23

    As everybody else has said, there is no difference. (As a sanity check I did some tests, but it was a waste of time, of course they work the same.)

    But there are actually FOUR types of inequality operators: !=, ^=, <>, and ¬=. See this page in the Oracle SQL reference. On the website the fourth operator shows up as ÿ= but in the PDF it shows as ¬=. According to the documentation some of them are unavailable on some platforms. Which really means that ¬= almost never works.

    Just out of curiosity, I'd really like to know what environment ¬= works on.

    0 讨论(0)
  • 2021-02-18 16:29

    There is no functional or performance difference between the two. Use whichever syntax appeals to you.

    It's just like the use of AS and IS when declaring a function or procedure. They are completely interchangeable.

    0 讨论(0)
  • 2021-02-18 16:29

    They are the same, but i've heard people say that Developers use != while BA's use <>

    0 讨论(0)
  • 2021-02-18 16:38

    They are the same (as is the third form, ^=).

    Note, though, that they are still considered different from the point of view of the parser, that is a stored outline defined for a != won't match <> or ^=.

    This is unlike PostgreSQL where the parser treats != and <> yet on parsing stage, so you cannot overload != and <> to be different operators.

    0 讨论(0)
  • 2021-02-18 16:42

    Developers using a mybatis-like framework will prefer != over <>. Reason being the <> will need to be wrapped in CDATA as it could be interpreted as xml syntax. Easier on the eyes too.

    0 讨论(0)
提交回复
热议问题