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