Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle inequality operator: ¬=

Tags:

oracle

Oracle SQL supposedly has four inequality operators:

  1. !=
  2. ^=
  3. <>
  4. ¬=

(PL/SQL operators are a little different. They allow ~= instead of ¬=. But that is not directly relevant here.)

The manual includes the warning "Some forms of the inequality condition may be unavailable on some platforms." This applies to at least the 4th option, ¬=. That syntax doesn't work for me on Windows, Linux, or Solaris.

My questions are:

  1. What platforms support ¬=?
  2. What platforms, if any, do not support !=, ^=, or <>? Is it worth avoiding one of those to ensure my code is as portable as possible?
like image 942
Jon Heller Avatar asked Feb 16 '12 05:02

Jon Heller


People also ask

Which is correct <> or != In Oracle?

No there is no difference at all in functionality. !=

Does != Work in Oracle?

In Oracle, not equal operator is used for checking inequality. != or <> can be used for checking inequality in a query.

What does <> mean in Oracle?

It means 'not equal to'.

How do you write greater than or equal to in Oracle?

In Oracle, you can use the >= operator to test for an expression greater than or equal to. SELECT * FROM suppliers WHERE supplier_id >= 1000; In this example, the SELECT statement would return all rows from the suppliers table where the supplier_id is greater than or equal to 1000.


2 Answers

Here's my best guess as to the derivation and availability of the various inequality operators:

  • <> - the original. Used by a number of languages (BASIC, Pascal, etc). Probably available on all platforms.
  • != - from C and it's derivatives (C, C++, Java, C#, etc, blah). I expect this is available on all platforms.
  • ¬= - This operator is probably only available on IBM mainframes. I know it's not supported on HP-UX as I just tried it. Near and dear to my heart. From the language PL/I (that's capital 'i', not '1', although it represents the Roman numeral "one", and thus the language is "pee ell one". I knew you wanted to know that :-), IBM's bastard stepchild...ahem, I mean "delightful combination" of FORTRAN, Algol, and a touch of COBOL. PL/I was the second high-level computer language I learned and the first one I used in making a living as a software developer. From the Good Old Days, when men were men, women were women, and computers were water-cooled. Isn't that right, Josiah..? (And ten points extra credit for those who can identify where THAT line comes from!)
  • ^= - I suspect this is meant to be similar to the preceding "IBM-only" operator, making it an "IBM-ish" operator for use on computers which lack the IBM "¬" (not) character. Probably supported on all platforms.

FWIW I always use <>. Old habits, like old programmers, die hard. :-)

like image 74

I always use !=. I do not know about the others, but != has always worked for me on windows and linux.

like image 44
Reid Avatar answered Sep 23 '22 11:09

Reid