find unused number within a range using just SQL
Hi everyone,
I have an Oracle table that holds random numbers within a specific range. Consider the following example:
Table A has only 1 column and it holds the following data
TABLE A
2
3
4
7
8
9
I need to write a query to provide me numbers that DO NOT exist in this table and that are within range of 1-10. So the result of this query would be
1
5
6
10
I want to do this using just SQL. I know I can do this easily using a while loop to populate a temp table with values from 1 to 10 and then just use minus. But I dont want to do that.
Also keep in mind that above is just an example, in reality these numbers are huge.
Any ideas?
Thanks