select count(1) into v_num from ... ;
if v_num <1 then
  insert into ...
end if;

解决方案 »

  1.   

    Insert Into t_inventory(FID,单据号,单据类型,日期,年度,月份,仓库编码)
        Values(Fid,bill,billstyle,fdate,fyear,fmonth,stock)
    where Not Exists(Select * From t_inventory Where Fid=Fid)
      

  2.   

    declare
    v_num number;
    begin
    select 1 into v_num from t_inventory Where Fid=Fid;
    exception
    when others then
    Insert Into t_inventory(FID,单据号,单据类型,日期,年度,月份,仓库编码)
        Values(Fid,bill,billstyle,fdate,fyear,fmonth,stock);
    end;
    /