我有两张表分别为TABLE1(a,b,c) TABLE2 (e,f) 怎么样把这两表合并成一张表table3(a,b,c,e,f)
------解决方案--------------------
create table t3 as select a,b,c,e,f from t1,t2 where ... and rownum <= 1;
truncate t3;
- SQL code
create or replace procedure proc is type t_cur is ref cursor; insert_cur t_cur; type t_rec is table of t3%rowtype index by binary_integer; rows_rec t_rec;begin open insert_cur for select a,b,c,e,f from t1,t2 where ...; loop fetch insert_cur bulk collect into rows_rec limit 1000; exit when insert_cur%notfound; forall i in rows_rec.first..rows_rec.last insert into t3 values rows_rec(i); commit; end loop;end proc;
------解决方案--------------------