procedure set_delete is
  begin
    delete from tbl_physical_contrast_sap s
     where (itemnum, lotnum, sernr, location, binnum, cpudt) in
           (select itemnum, lotnum, sernr, location, binnum, cpudt
              from tbl_physical_contrast_sap
             group by itemnum, lotnum, sernr, location, binnum, cpudt
            having count(*) > 1)
       and charg is null;
  end set_delete;这个存储过程,是要删除charg为空的字段,但是,如果说lotnum 或者 sernr 字段为空的话,删除不成功,该怎么进行判断呢,谢谢···

解决方案 »

  1.   

    是要删除charg为空的数据,不好意思,写错了···
      

  2.   

    delete from tb_name
    where charg is null and ( lotnum is not null or sernr is not null );-- 删除不成功,是什么意思?是不能删除?还是你执行删除操作失败呢?
      

  3.   

    我要对比两条数据这些字段一致,如果charg这个字段是空的话,我要进行删除,但是有一个问题是,如果 lotnum 或者 sernr 这个字段为空的话,就还是两条数据,无法进行删除charg这个字段为空的数据