如何在给定增量范围的情况下将多行插入表中,并且行中的一列包含值?
最佳答案
INSERT INTO YourTable(YourColumn)
SELECT 1 + (Level -1) * YourIncrement from dual connect by Level < TotalNumbers)
i.e.
INSERT INTO YourTable(YourColumn)
SELECT 1 + (Level -1) * 1 from dual connect by Level < 100)
创建序列 1,2,3...99
INSERT INTO YourTable(YourColumn)
SELECT 1 + (Level -1) * 2 from dual connect by Level < 100)
创建序列 1、3、5 .. 100
或者您可以使用 SEQUENCES
关于sql - 将范围自动插入到 Oracle 表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3728102/