Apply a trigger on relation client (sno, fname, lname, eid, and password) on attributes fname and password after/before delete or update these columns. The trigger should insert the old or deleted values from both these columns into a new table client1.
create table client(sno number(10), fname varchar(20), eid number(10),passwrd varchar(20));
insert into client values(001,'JAMES',101,'james101');
select * from client
----------------
create table client1(sno1 number(10), fname1 varchar(20), eid1 number(10),passwrd1 varchar(20));
--drop table client
select * from client1
---------------------
create or replace trigger client_trigg
before delete or update on client
for each row
Begin
insert into client1 values(:old.sno,:old.fname,:old.eid,:old.passwrd) ;
end;
update client set passwrd='james20' where sno=001;
delete from client where sno=001;
Comments
Leave a comment