Home » SQL & PL/SQL » SQL & PL/SQL » Error in Trigger (Oracle, 10g, windows XP)
Error in Trigger [message #330985] Wed, 02 July 2008 00:50 Go to next message
jyothsna1612
Messages: 68
Registered: June 2008
Member
Could you please help me to solve the error in this code.

create table tab1(a number,b number,c number)

create table tab2(ola number,a number,olb number,b number,olc number,c number,event varchar2(23))

create or replace trigger tr_tab1
before insert or update or delete on tab1
for each row
begin

if inserting then
insert into tab2(a,b,c,event) values
(:new.a,:new.b,:new.c,'before insert');

elsif updating then
insert into tab2(ola,a,olb,b,olc,c,event) values
(:old.a,:new.a,:old.b,:new.b,:old.c,:new.c,'before update');

elsif deleting then
insert into tab2(ola,olb,olc,event) values
(:old.a,:old.b,:old.c,'before delete);
end if;
end;

I'm unable to find the error in that code

The error is:

Warning: compiled but with compilation errors
(S223) Expecting: statement_terminator BEGIN CASE DECLARE END
IDENTIFIER IF LOOP
Error at line 13
ORA-00928: missing SELECT keyword

Re: Error in Trigger [message #330991 is a reply to message #330985] Wed, 02 July 2008 01:27 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Check propery

Your code

elsif deleting then
insert into tab2(ola,olb,olc,event) values
(:old.a,:old.b,:old.c,'before delete);
end if;
end;



change like below

elsif deleting then
insert into tab2(ola,olb,olc,event) values
(:old.a,:old.b,:old.c,'before delete');
end if;
end;


kanish
Re: Error in Trigger [message #330995 is a reply to message #330985] Wed, 02 July 2008 01:33 Go to previous message
jyothsna1612
Messages: 68
Registered: June 2008
Member
Ooh!

Thank you very much Kanish
Previous Topic: Sql query help
Next Topic: circular sql ?
Goto Forum:
  


Current Time: Wed Dec 07 18:27:39 CST 2016

Total time taken to generate the page: 0.09803 seconds