SQL Query to return N rows from dual
问题 I want to write a SQL query which accepts a bind variable (say :NUM) and its output consists of one column & :NUM number of rows, each row having its row number. i.e. if we pass :NUM as 7, the output should be: VAL ==== 1 2 3 4 5 6 7 There shouldn't be any actual DB tables in query and no PL/SQL code should be used. i.e. only dual should be used in the query Is there any way to achieve this? 回答1: You could use: WHERE ROWNUM <= :NUM ...but the table has to contain row equal or greater to the