开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜