0

It's not really important, but just wondering why the Oracle SQL seems to be quote inconsistent? I mean why do they have...

NOT IN (?,?,?)  

and

!= '?'

rather than

NOT EQ '?'

Just a thought

K

KS1
  • 1,019
  • 5
  • 19
  • 35
  • With `NOT IN (?,?,?)` you compare to a **list of expressions** (or subquery), e.g. numbers. With `!= '?'` you compare with a single **string** literal. Oracle is consistent in this. – Wernfried Domscheit May 02 '18 at 10:40
  • 1
    i think you're confusing some things. NOT IN is used to compare with a list of values. The != operator is to compare one value with another. A similar notion to what you wrote as NOT EQ '?' might be the NOT LIKE '?' – Renato Afonso May 02 '18 at 10:45
  • 1
    Actually it's `<> '?'` in standard SQL –  May 02 '18 at 10:45

2 Answers2

0

NOT IN ( ?, ? ) is ISO 9075 SQL standard syntax. I do wonder what symbols could possibly be used to denote "not in". That seems silly, since "mathematical" symbols such as != are almost self-documenting, and the "set" type symbols needed for "not in" aren't available on most keyboards, nor would they be familiar to most developers.

Note that neither != nor NOT EQ are ISO-standard. The standard "not equals operator" is <>, but as noted here, the != has some advantages.

Andrew Henle
  • 32,625
  • 3
  • 24
  • 56
0

In the code NOT IN (?,?,?) the question marks appear to be positional parameters from a parameterized query, while the code != '?' is a comparison to a string literal. If you had wanted it parameterized it would have been != ? without the single quotes.

Sentinel
  • 6,379
  • 1
  • 18
  • 23