如果给定增量范围,如何在表中插入一些行,并且该行的一列包含值?
答案 0 :(得分:7)
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