update rpt_table_target a set a.reprownum = (select b.reprownum+1 from rpt_table_target b where b.tabname='S4500' and b.reprownum >'10' )
where a.tabname ='S4500' and a.reprownum > '10' 
and exists (select a.reprownum from rpt_table_target a where a.tabname='S4500' and a.reprownum >'10')
无非就是想在  修改和增加的同时  变更此 > 此数据的 序列号+1 
使序列号 保持 不重复的状态累积...SQL 更新不明白了...求教育啊

解决方案 »

  1.   

    select b.reprownum+1 from rpt_table_target b where b.tabname='S4500' and b.reprownum >'10' 返回的行数不唯一吧?单独运行下这个语句看看咯
      

  2.   

    总写连表的 给想复杂了..update rpt_table_target a
       set a.reprownum = a.reprownum - 1
     where a.tabname = 'S4500'
       and a.reprownum > '1'
       and exists (select a.reprownum
              from rpt_table_target a
             where a.tabname = 'S4500'
               and a.reprownum > '1')
    这么一写 就好了...哎...
      

  3.   

    子查询后添加 and rownum=1(限oracle)
      

  4.   

    你这个语句写的真是有问题update rpt_table_target set reprownum  = reprownum  + 1
     where a.tabname ='S4500' and a.reprownum > '10' 这样不就行了吗?