2
I’m trying to find the numbers that haven’t been entered in the bank yet.
I have a client table, in it I have the fields codigo
and nome
.
When the user registers the client, he puts the code manually, so he risks skipping some numbers.
Is there any way SQL
for me to try to select these numbers that have not yet been registered?
Some reason not to use a primary incremental key as code ?
– gmsantos
The "code" column is of the whole type?
– Jean Gustavo Prates
It is of type integer yes and primary key. It is that in fact the user determines the number to register
– Emerson
@Emerson there is the danger. He really needs to determine the number? Why ? I don’t see a good reason to allow this.
– gmsantos
So @gmsantos, I found a different way, a system that draws more attention. Because I want to put aside the number that hasn’t been registered yet!
– Emerson
What you want is possible with
SEQUENCE
. You can predict what the next code will be =)– gmsantos