PL/SQL (MOSC)

MOSC Banner

delete trigger

edited Jul 6, 2013 11:58PM in PL/SQL (MOSC) 6 commentsAnswered ✓
create table dsls041_copy as select * from dsls041;

alter table dsls041_copy add (flag char(1));

I have created a trigger so that whenever the source table gets inserted with a new row, or updated, the responding change will happen in the copy table.

create or replace trigger AFTER_INSERT_UPDATE_DSLS041
after insert or update on DSLS041100
for each row
declare
v_flag char(1) :='0';
begin
if INSERTING then
insert into dsls041_copy
(column1,
column2,
flag)
values
(:new.column1,
:new.column2,
v_flag);
elsif updating then
update dsls041_copy set
column2 = :new.column2,
flag = v_flag
where column1 = :old.column1;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center