Oracle处置

Oracle处理
一、情况:
1、现有tableA,tableB两张表,表结构一样。现希望把tableB的内容插到A中,“序号”和“学号”在各自表中都是唯一不重复的。
2、tableA存在于oracle中,tableB是导出的csv格式或者sql格式;

要求:
1、如果与tableA字段“学号”重复,则该条记录不插入;
2、插入的记录,字段“序号”不能与tableA中现有的“序号”重复,应该以101开始递增;
3、tableA表结构不能作修改,如设主键等;
4、两个表的数据大概22G,效率不能太低;
-- Create sequence 
create sequence SEQ_TABLEA
minvalue 1
maxvalue 999999999999999
start with 101
increment by 1
cache 20;
--插入数据
insert into tablea(序号,学号,考勤)
select seq_tablea.nextval,学号,考勤 from tableb b
where not exists (select 1 from tablea a where a.学号=b.学号)



二、Oracle两个表的结果如何拼接
select t1.rn, t1.name || t2.name
  from (select rownum rn, t1.name from t1 where rownum < 5) t1,
       (select rownum rn, t2.name from t2 where rownum < 5) t2
 where t1.rn = t2.rn