The demand of a recent customer is really abnormal .
A system number string is required , String by 3 Part composition , The first two are Pinyin abbreviations of Chinese characters , It's not difficult .
The last part is one 4 Pure number of digits from 0001~9999,
Every time you insert a piece of data, you have to judge whether 0001 Start to 9999 between , The first number that doesn't exist , If the number has been reached, it will not be repeated , Possible continuity ,( If it is not deleted, you only need to retrieve it every time max+1 that will do , However, it may be deleted in the middle , There is a disconnection , Then the newly inserted data must be filled in ).
Now the idea is to take a list , Sort by number , And then rownu Go and compare , And then rownum Compare it with his number number
rownum || systemno
1 1
2 2
3 3
4 4
5 5
6 7
So find the first one rownum Unequal numbers are not impossible
select min(rn) from (
select rownum rn,bts_system_no from (select bts_system_no from bo_bts where
bts_system_no is not null
order by to_number(bts_system_no))) where rn < to_number(bts_system_no)
Basically, we can get the first number 6
Technology
Daily Recommendation