1. 程式人生 > >sql%rowcount 返回影響行數

sql%rowcount 返回影響行數

oracle中,返回影響行數是:If sql%rowcount

舉例:

      update ut_calenderStatus t
      set t.calenderstatus=pi_flg,
          t.m=pi_M,
          t.n=pi_N,
          t.prolong=pi_prolong
      where t.fundcode=pi_fundcode;
      if sql%rowcount=0 then
        insert into ut_calenderStatus
        values (pi_fundcode,pi_flg,pi_M,pi_N,pi_prolong);
      end if;


BEGIN
    update MY_TIME_TEST1 set discript = '6' where discript = '1' ;
    If sql%rowcount>1  then 	--上面update影響行數>1就插入到my_time_test1
    insert into MY_TIME_TEST1 values(sysdate,'7');
    end if;
END;