After update how do u know how many records got updated

Answers were Sorted based on User's Feedback



After update how do u know how many records got updated..

Answer / 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

After update how do u know how many records got updated..

Answer / mahima

use @@rowcount

Is This Answer Correct ?    3 Yes 1 No

After update how do u know how many records got updated..

Answer / shail

If using SQL*PLUS then use

set feedback on

Is This Answer Correct ?    1 Yes 0 No

After update how do u know how many records got updated..

Answer / pkd

Except sql%rowcount,using returning clause with count()
function

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Oracle General Interview Questions

Can group functions be used in the order by clause in oracle?

0 Answers  


26. Display the earliest shipping date in the format: DD/MON/YYYY

5 Answers   Wipro,


How does oracle handle read consistency?

0 Answers  


Is rowid unique in oracle?

0 Answers  


How to put more than 1000 values into an oracle in clause?

0 Answers  






what are the disadvantages of hierarchial database over RDBMS?

1 Answers   TCS,


In which dictionary table or view would you look to determine at which time a snapshot or MVIEW last successfully refreshed?

1 Answers  


Explain constraining triggers.

0 Answers  


how to retrieve 1st and last row of table without using group functions??

6 Answers  


How to end the current transaction in oracle?

0 Answers  


What are the different approaches used by Optimizer in choosing an execution plan ?

2 Answers  


What is the function of Redo Log ?

1 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)