How can we Get the Updated Rows? ie, There is 100s of Rows i
updated the Rows who have salary 5000. then i want to select
the Updated Rows. How can we achieve it?

Answers were Sorted based on User's Feedback



How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000...

Answer / srinivas

first create new table with the same structure if table_name1
then create a trigger as follws

create or replace trigger <trigger_name>
after update on <table_name1>
for each row
begin
insert into <new_table_name>
values(:new.<column_name1>,:new.<column_nam2>...... );
end;

then update table_name1 table
after that check it new table

Is This Answer Correct ?    4 Yes 0 No

How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000...

Answer / mahesh

create table t1 as select * from emp where 1=2;

create or replace trigger t1
after update on emp
for eachrow
begin
insert into t1
values(empno,'ename',job,'hiredate',sal,comm,deptno);

end;
after create trigger
then u updated.

Is This Answer Correct ?    5 Yes 5 No

How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000...

Answer / sandeeptiwari1111@gmail.com

We can achieve this w/o using any Trigger also.
For this result you just need to put your update statement inside this below block


begin
----Your udate statement
dbms_output.put_line(sql%rowcount);
end;

Is This Answer Correct ?    1 Yes 3 No

How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000...

Answer / sudipta santra

create table t1 as select * from emp;
truncate table t1;

create or replace trigger tri_t1
before update on emp
for eachrow
begin
insert into t1
values(old.empno,old.ename,old.job,old.hiredate,old.sal,
old.comm,old.deptno);

end;
after create trigger
then if u update then the old updated values will be kept
in t1 table.

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

Differences between UNIQUE and DISTINCT in select statements

26 Answers   ABS, DELL, Deloitte, Hewitt, Oracle, Verinon Technology Solutions, Wipro,


What are the different types of sql commands?

0 Answers  


What are the uses of merge?

0 Answers  


TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A 1 A 2 B 2 B 3 C 3 C 4 D 4 D 5 E 5 E 6 F 7 G HOW TO GET THE UNMATCHED RECORDS IN SQL QUERY?

10 Answers   Satyam,


What is nested table in pl sql?

0 Answers  






Why you are not able to create a table using select command,if it is having a LONG column? for eg:create table test as select * from test1 here test1 containg a column having LONG datatype...

1 Answers  


What will you get by the cursor attribute sql%found?

0 Answers  


How is data stored on a disk?

0 Answers  


what is sql server agent? : Sql dba

0 Answers  


What are keys in sql?

0 Answers  


what is self join and how it works??

2 Answers   Infosys,


What are sql data types?

0 Answers  


Categories