Oracle SQL supposedly has four inequality operators:
!=
^=
<>
¬=
(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:
¬=
?!=
, ^=
, or <>
? Is it worth avoiding one of those to ensure my code is as portable as possible?No there is no difference at all in functionality. !=
In Oracle, not equal operator is used for checking inequality. != or <> can be used for checking inequality in a query.
It means 'not equal to'.
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.
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. :-)
I always use !=. I do not know about the others, but != has always worked for me on windows and linux.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With