刚才是我没提交,但是插入1000到2000行数据时,我写的条件是where rownum >= 1000 and rownum < 2000,怎么提示 0 rows inserted?

解决方案 »

  1.   

    rownum和rownum都是伪列,就是不存在的列,只能用于<或者<=语句里
    例如
       select * from emp where rownum<5;你的句子中where rownum>=1000是不对的
      

  2.   

    她提示说违反唯一约束条件,意思是说B表里的某个字段属性为UNIQUE或者主键,必须是不重复的,可能你的源表A有重复的项
      

  3.   

    insert into B(f1,f2,f3,f4,f5)
    select f1,f2,f3,sysdate,'0' from A where rownum <1000
    and not exists(select * from B where b.主键=a.主键)
      

  4.   

    insert into B(f1,f2,f3,f4,f5)
    select f1,f2,f3,sysdate,'0' from B where rownum <1000看一下B表中的对应的字段的类型是否全部和A表中的类型一致. 直接用rownum<1000只能插入前999条数据.要全部插入,用游标.