I've got a table which have a column describing a numeric ID, which is unique for all the rows (but it's not the primary key). The numeric ID are limited (let's say for the answer that can be from 1 up to 10)
SELECT ID FROM TABLE;
ID
---
1
2
5
I've got to present to the user (via a UI) the unused values to let choosing a correct value for a new input. I know how to do it on code (it's a Grails web application), just get all the ID from database and generate a list with the ones that are not present. But I want to know if there is a way to do it directly on the SQL query.
So, that query should return
ID
---
3
4
6
7
8
9
10
The database is Oracle, but maybe there's a way to do it that work on other databases as well.