After update how do u know how many records got updated

Answer Posted / svj

Using SQL Cursor Attribute,'SQL%ROWCOUNT' which gives
no.of rows affected by the most recentSQL statement (an
integer value), one can know no.of records got updated.

For Example :

VARIABLE rows_updated VARCHAR(30)
DECALRE
v_dept_no departments.department_id%TYPE := 20
BEGIN
UPDATE employees
SET salary = salary + 1000
WHERE department_id = v_dept_no;
: rows_updated := (SQL%ROWCOUNT || 'rows updated.');
END;
/
PRINT rows_updated

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain an index?

654


20. Using a set operator, display the client number of all clients who have never placed an order.

1791


A table t is there.If you perform insert ,update and delete then the trigger will fire.What is the minimum no of trigger required for a table.

4238


How can we find out the current date and time in oracle?

634


What is a nested table?

621






What do you mean by merge in oracle and how can you merge two tables?

513


How to experiment a data lock in oracle?

588


How to use existing values in update statements using oracle?

538


Can we create database in oracle using command line ?

575


I have a parent program and a child program. I want to write a statement in Exception Block of the parent program so that when the statement in the exception block is executed, the control goes to the next statement in the parent block bypassing the child block.How do i do that?

1967


Explain the types of exception?

641


How to use subqueries with the exists operator in oracle?

604


How to define a sub function?

656


What is Library Cache in Oracle?

633


In AP we done Customizations for Late Payments Charges. For Reporting Purpose What are the Documents Prepared for Customer Understanding??

1199