oracle sql%rowcount 返回影响行数

 

sqlserver中,返回影响行数是:If @@RowCount<1 

oracle中,返回影响行数是:If sql%rowcount<1 

例:

sqlserver:

AS
BEGIN		
		Update T_Mt Set Stat=@Stat,OStat=@Stat,RptTime=Getdate() Where MsgId=@MsgId
		If @@RowCount<1		--没有更新成功就插入到t_Statbuf
		insert into t_statbuf(MsgId,Stat,RptTime) values(@MsgId,@Stat,Getdate())				
END


oracle:

CREATE OR REPLACE PROCEDURE test

AS
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;



 

你可能感兴趣的:(oracle,sql,insert,sqlserver)