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

how many outer joins are used in a single sql query? is there any limitations for using of outer joins?

2 Answers   BOB Technologies, Cap Gemini, IBM,


How to connect asp pages to oracle servers?

0 Answers  


does the query needs a hint to access a materialized view?

0 Answers  


How do we know whether an index is created on a table ???

2 Answers   TCS,


How to add a new column to an existing table in oracle?

0 Answers  






What is cluster Key ?

3 Answers  


What is a cognitive schema?

0 Answers  


What is meant by recursive hints ?

1 Answers  


What is dynamic proxy?

0 Answers  


Explain the use of parfile option in exp command.

0 Answers  


Explain a synonym?

0 Answers  


What are the different oracle database objects?

0 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)