[sql] Oracle Not Equals Operator

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

What's the difference between them? I heard that != is more efficient than other for comparing strings. Could anyone give a qualitative comment on this statement.

This question is related to sql oracle

The answer is


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.


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


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.


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.


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