开发者

Auto-insert a range into an Oracle table

开发者 https://www.devze.com 2023-01-16 05:17 出处:网络
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)

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

精彩评论

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

关注公众号