方法一: INSERT /*+Append*/ INTO tab1 SELECT * FROM tab2;方法二:假如TAB1表中的没有数据的话,先把原表DROP掉,然后在CREATE AS,比如: DROP TABLE TAB1; CREATE TABLE TAB1 AS SELECT * FROM TAB2; 然后在此基础上建立索引。更多方法,请参考:http://blog.csdn.net/tianlesoftware/article/details/4745144
30W 就算用PL/SQL自带工具的话,10分钟内也完成了吧
不是这样的,假如一个商品A,A商品有供应商1,供应商2,供应商3,供应......,我想生成10000个商品,当然也要生成这些商品所对应的供应商。现在我已经生成了SQL语句,太大了,大约30W条SQL语句 例如 insert into product select 100(自动编号ID),‘proudctidB’,...... from product where productid='A'; insert into Supplier select 101(自动编号ID),‘SupplierB' ,...... from product where SupplierID='A';.....................insert into product select 100(自动编号ID),‘proudctidB’,...... from product where productid='N'; insert into Supplier select 101(自动编号ID),‘SupplierB' ,...... from product where SupplierID='N'; 我要怎么运行是最佳的,写个程序,还是直接在PL/SQL中运行?
INSERT /*+Append*/ INTO tab1
SELECT * FROM tab2;方法二:假如TAB1表中的没有数据的话,先把原表DROP掉,然后在CREATE AS,比如:
DROP TABLE TAB1;
CREATE TABLE TAB1 AS SELECT * FROM TAB2;
然后在此基础上建立索引。更多方法,请参考:http://blog.csdn.net/tianlesoftware/article/details/4745144
就算用PL/SQL自带工具的话,10分钟内也完成了吧
例如
insert into product select 100(自动编号ID),‘proudctidB’,...... from product where productid='A';
insert into Supplier select 101(自动编号ID),‘SupplierB' ,...... from product where SupplierID='A';.....................insert into product select 100(自动编号ID),‘proudctidB’,...... from product where productid='N';
insert into Supplier select 101(自动编号ID),‘SupplierB' ,...... from product where SupplierID='N';
我要怎么运行是最佳的,写个程序,还是直接在PL/SQL中运行?
做成sql文件直接在sqlplus命令行执行@xxx.sql就行了