Oracle Sql%rowcount Returns the number of rows affected, SQL Server @ @RowCount returns the number of affected rows

Source: Internet
Author: User
Tags rowcount

In SQL Server, the number of affected rows returned is: If @ @RowCount <1

In Oracle, the number of affected rows returned is: If sql%rowcount<1

Cases:

Sql server:

Create procedureproc_test@Stat int=0,    @MsgId varchar( -)="', as  BEGIN                 UpdateT_mtSetStat=@Stat, Ostat=@Stat, Rpttime=Getdate()WhereMsgId=@MsgId          If @ @RowCount<1      --INSERT into T_STATBUF without update success        Insert  intoT_statbuf (Msgid,stat,rpttime)Values(@MsgId,@Stat,Getdate())                  END  

Oracle

CREATE OR REPLACE PROCEDURETest as  BEGIN      UpdateMy_time_test1SetDiscript= '6' whereDiscript= '1' ; IfSql%RowCount>1   Then  --The above update affects the number of rows >1 is inserted into the My_time_test1    Insert  intoMy_time_test1Values(Sysdate,'7'); End if; END;

Reference: http://www.linuxidc.com/Linux/2012-01/51693.htm

Oracle Sql%rowcount Returns the number of rows affected, SQL Server @ @RowCount returns the number of affected rows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.