我有表交易表
create table TXN_HEADER
(
txn_id NUMBER(10) not null,
txn_Date date
product_id NUMBER(10),
company_id NUMBER(10),
dealer_id NUMBER(10),
tran_amt number(10,2)
)
Run Code Online (Sandbox Code Playgroud)
上表具有对product.product_id 和company.company_id 的外键引用。
该表有 5m 行
create table TXN_HEADER_REPORTS
(
txn_id NUMBER(10) not null,
txn_Date date
product_id NUMBER(10),
company_id NUMBER(10),
dealer_id NUMBER(10),
tran_amt number(10,2)
)
Run Code Online (Sandbox Code Playgroud)
这里我们也有相同的约束,具有对product.product_id和company.company_id的外键引用。
在模式 2 中,我们尝试一次性插入从模式 1 到模式 2 的所有行,如下所示
begin
insert into TXN_HEADER_REPORTS (
txn_id, txn_Date ,product_id,company_id , dealer_id , tran_amt)
select
txn_id, txn_Date ,product_id,company_id , dealer_id , tran_amt
from schema1.TXN_HEADER;
commit;
exception
when …Run Code Online (Sandbox Code Playgroud)