Usage of Sql%notfound in Oracle database

Source: Internet
Author: User

Sql%notfound is a Boolean value. Interacts with the most recent SQL statement (Update,insert,delete,select), which returns True when the most recent SQL statement does not involve any rows. Otherwise, false is returned. Such statements are useful in practical applications. For example, to update a row of data, if not found, you can do the appropriate action. Such as:

Begin

UPDATE table_name Set salary = 10000 where emp_id = 10;

If Sql%notfound Then

INSERT INTO table_name (id,name,salary) VALUES ("", "", "");

End If;

End

When update emp_id is 10, insert a piece of data if the update affects 0 bars.

The usage of Sql%found is in contrast to the Sql%notfound usage, and is also an interaction with the most recent SQL statement, true if the number of rows affected is greater than 0.

otherwise, false.

Sql%rowcount is null before DML statements are executed, execution succeeds for the SELECT INTO statement with a value of 1, and a value of 0 if unsuccessful.

Usage of Sql%notfound in Oracle database

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.