PL/SQL Cursor Exercises: Find the number of rows effected by the use of SQL%ROWCOUNT attributes of an implicit cursor
PL/SQL Cursor: Exercise-3 with Solution
Write a program in PL/SQL to find the number of rows effected by the use of SQL%ROWCOUNT attributes of an implicit cursor.
Sample Solution:
PL/SQL Code:
DROP TABLE emp_temp;
CREATE TABLE emp_temp AS
SELECT employee_id, first_name, last_name,email
FROM employees;
BEGIN
UPDATE emp_temp
SET email = 'not available'
WHERE first_name LIKE 'B%';
dbms_output.Put_line('Number of record updated: '
||To_char(SQL%rowcount));
END;
/
Sample Output:
Number of record updated: 2 PL/SQL procedure successfully completed.
Flowchart:
Improve this sample solution and post your code through Disqus
Previous: Write a program in PL/SQL to show the uses of CURVAL and NEXTVAL with a sequence name.
Next: Write a program in PL/SQL to show the uses of implicit cursor without using any attribute.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework