在 Oracle 中使用 join select 查询生成动态数据

Generating dynamic data using join select query in Oracle

我们有一个 select query 包含大约 10 tables。使用 query 我们只得到 50 record。我们需要获得 50k 记录。实际上我们没有功能性的理解来将数据生成到这些 tables.

有没有可能,我们可以创建 insert 查询以使用那个 select 查询将数据插入到这 10 个 table 中,即使数据不完整。我们只需要对环境进行音量测试。

假设我有以下查询

select d.deptno, d.dname,e.ename from dept d, emp e where d.deptno=e.deptno(+);

是否可以在不修改数据的情况下为 empdept 创建 insert query?我的意思是我们可以将 table 的主键增加一个 id 并生成数千条记录?可能吗?

我只是在想这样的事情是否可行。

您可以生成数字列表并重复插入。假设主键是自动生成的,您可以生成任意数量的数字,只需插入:

insert into emp ( . . . )
with n as (
      select level as n
      from dual
      connect by level + 1 < 100
     )
select . . .
from n;