Given the following table data:
Students.id
-----------
1
2
3
If I want to select ids from a table that are not in an array of numbers, I can do the following:
SELECT id FROM Students
WHERE id NOT IN (1, 3, 5);
Result: (2)
But I want to do the opposite - select numbers from an array that are not in a table. How can I do that?
Here have been my attempts so far:
Attempt 1:
SELECT id FROM TABLE(1, 3, 5)
WHERE id NOT IN (SELECT id FROM Students);
RESULT: ORA-00907: missing right parenthesis
------------------------
Attempt 2:
SELECT (1, 3, 5) FROM dual
WHERE ??? NOT IN (SELECT id from Students); -- not sure what the column name should be
RESULT: Executing the first line alone gives the error ORA-00907: missing right parenthesis
--------------
Attempt 3:
SELECT TABLE(1,3,5) AS ids FROM dual
WHERE ids NOT IN (SELECT id FROM Students);
RESULT: ORA-00936: missing expression
Desired results (from my examples): (5)
Note: I found this related question, but alas it is also unanswered. Like Fuzz, my array of numbers are not stored in a table.