SQL to generate a list of numbers from 1 to 100

后端 未结 11 1509
悲&欢浪女
悲&欢浪女 2020-11-27 04:07

Using the DUAL table, how can I get a list of numbers from 1 to 100?

11条回答
  •  一整个雨季
    2020-11-27 04:31

    Do it the hard way. Use the awesome MODEL clause:

    SELECT V
    FROM DUAL
    MODEL DIMENSION BY (0 R)
          MEASURES (0 V)
          RULES ITERATE (100) (
            V[ITERATION_NUMBER] = ITERATION_NUMBER + 1
          )
    ORDER BY 1
    

    Proof: http://sqlfiddle.com/#!4/d41d8/20837

提交回复
热议问题