ORACLE
create tables
==========================================================================
create table student (rno number(2), name varchar(10), stream varchar(10));
create table bca_student as select * from student where 1 = 2;
create table bscit_student as select * from student where 1 = 2;
=========================================================================
create trigger
=========================================================================
create or replace trigger system.trig_stud after delete on student for each row
begin
if :old.stream = 'bca' then
insert into bca_student values(:old.rno,:old.name,:old.stream);
dbms_output.put_line('Record inserted...');
else
insert into bscit_student values(:old.rno,:old.name,:old.stream);
dbms_output.put_line('Record inserted...');
end if;
end;
=========================================================================
delete from student where stream = 'bca';
delete from student where stream = 'bscit';
=========================================================================
Comments
Post a Comment