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

what does myisamchk do? : Sql dba

0 Answers  


Can we use insert statement in function?

0 Answers  


Can we use SQL%ISOPEN in implicit cursors? Does this attribute works properly in Implicit Curosors?

3 Answers  


Which sorts rows in sql?

0 Answers  


types of exceptions and what is meant by pragma autonomous_transaction ?what is the use.

4 Answers   3i Infotech,






What are Anti joins

1 Answers   IBM,


What is sql and db2?

0 Answers  


i have some prob lem to tell me about my self in interview first round ...

0 Answers  


What are the different types of database management systems?

0 Answers  


Is drop table faster than truncate?

0 Answers  


what is HASH join?

2 Answers   Genpact, HCL,


How do I remove sql plus from windows 10?

0 Answers  


Categories