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)
Try this way:
insert into edgar_t100 (col1)
select rownum as ID
from dual
connect by rownum <= 100
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.