Auto-insert a range into an Oracle table
How would i insert a number of rows into 开发者_Python百科a table given an incremental range, with one column of the row containing the values?
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)
create sequence 1,2,3...99
INSERT INTO YourTable(YourColumn)
SELECT 1 + (Level -1) * 2 from dual connect by Level < 100)
create sequence 1, 3, 5 .. 100
Or you can use SEQUENCES
精彩评论