insert into table1 select b. * from table2 b ,(select count(1) cnt from table1where num=00010 and rownum<2 )a where a. cnt=0;
请问这句sql是什么意思?

解决方案 »

  1.   

    从语句上来说:如果表  table1 中,不存在 num=00010 的记录,就把 table2 中的数据,全量插入到 table1 中。
      

  2.   

    换一个写法,看看您能不能看懂。
    insert into table1 select b. * from table2 b where exists(select 0 cnt from table1 where num=00010) ;
      

  3.   

    好像是not exists 。。