在一堆数字中找出一个未使用的数字
我有一张巨大的桌子,里面装满了数字(1001001..1009999),并且该区域肯定有一堆未使用的数字。因此,我可以通过执行以下操作来返回所有这些数字:
SELECT MY_IDENTIFIER FROM MY_TABLE
这将返回所有使用过的数字。我如何从该表中获取未使用号码的列表?我使用 JavaScript 在服务器端(rhino/jaxer)工作,我的数据库是 Oracle 10g。
谢谢,
I have a huge table filled with numbers (1001001..1009999) and there are certainly a bunch of unused numbers in that area. So, I could have all these numbers returned by doing:
SELECT MY_IDENTIFIER FROM MY_TABLE
that would return all used numbers. How could I get a list of unused numbers from that table? I work serverside (rhino/jaxer) with JavaScript and my database is Oracle 10g.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下查询将为您提供所需内容:
将 &&v_to 和 &&v_from 替换为您的边界数字。
参考:http://oraqa. com/2006/01/20/如何生成两个数字之间的序列/
The following query will give you what you need:
Replace &&v_to and &&v_from with your boundary numbers.
Reference: http://oraqa.com/2006/01/20/how-to-generate-sequence-numbers-between-two-numbers/
Javascript 与此并没有真正的关系,不是吗?
几年前我也做过类似的事情。
我有一个表,其中包含一定范围内的所有数字,并将这两个表连接起来并选择那些无法连接的数字。负选择。
像这样的东西
Javascript is not really related to that, isn't it?
I did something similiar years before.
I had a table with all numbers in a range and joined these two tables and selected those numbers which could not be joined. A negative select.
Something like