1

I have a table, edgar_t100 and which is a table of one column, named ID. I need it to have 100 rows where each row/column intersection is just the number of the row. Obviously I don't want to do this by writing insert clauses, so I thought about using the dual table from Oracle.

If I do, select rownum as ID from dual connect by rownum <= 100, then I get a nice table that captures exactly what I want.

Is there a way to do something like the following:

insert into edgar_t100 values (select rownum as ID from dual connect by rownum <= 100) (Obviously that doesn't work and I want to do this using SQL)

4

1 回答 1

3

试试这个方法:

insert into edgar_t100 (col1) 
select rownum as ID 
from dual 
connect by rownum <= 100
于 2013-09-10T20:24:58.993 回答