Oracle SQL % rowcount returns the number of affected rows

Source: Internet
Author: User

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

Example:

Sqlserver:

[SQL]
  1. AS
  2. BEGIN
  3. UpdateT_MtSetStat = @ Stat, OStat = @ Stat, RptTime = Getdate ()WhereMsgId = @ MsgId
  4. If @ RowCount <1-- Insert to t_Statbuf if no update is successful
  5. Insert IntoT_statbuf (MsgId, Stat, RptTime)Values(@ MsgId, @ Stat, Getdate ())
  6. END

Oracle:

[SQL]
  1. CREATE OR REPLACE PROCEDURETest
  2. AS
  3. BEGIN
  4. UpdateMY_TIME_TEST1SetDisallow ='6' WhereDisallow ='1';
  5. If SQL % rowcount> 1Then-- Insert the number of rows affected by the above update to my_time_test1 if the number is greater than 1
  6. Insert IntoMY_TIME_TEST1Values(Sysdate,'7');
  7. EndIf;
  8. END;

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.