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
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 |
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 |
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 |
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 |
i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output. trans_id trans_amt debit_credit_indicator i want get highest credit amount and lowest credit amount and highest debit amount and lowest debit amount for each trans_id. pls give me answer. i want urgent
Are stored procedures compiled?
what are the drivers in mysql? : Sql dba
what is the sql query to display current date? : Sql dba
what is ref cursor in pl/sql?
Explain what is sql?
How do you rank data in sql?
Can you call pl/sql package functions from within a fast formula?
What are the qualities of 2nf?
How many commands are there in sql?
What is offset in sql query?
How to run sql statements with oracle sql developer?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)