Home » SQL & PL/SQL » SQL & PL/SQL » Compilation error
Compilation error [message #35702] Mon, 08 October 2001 01:53 Go to next message
shofi
Messages: 9
Registered: October 2001
Junior Member
Hi All,
I want to input id varchar(10) into Employee_general_info table & will be inserted in Basic_Status table id varchar(10) by a trigger. I have a trigger with compilation error like below. Could anyone help me to solve this?

Trigger:

create or replace trigger trg_ins_id
after delete or insert or update on EMPLOYEE_GENERAL_INFO
for each row
declare
idn varchar(10);
begin
select id into idn from EMPLOYEE_GENERAL_INFO;
if deleting then
delete from basic_status
where id=idn;
elseif inserting then
insert into basic_status (id)
values (idn);
else updating then
update basic_status
set id=idn;
end if;
end;
/


----------------------------------------------------------------------
Re: Compilation error [message #35703 is a reply to message #35702] Mon, 08 October 2001 03:29 Go to previous messageGo to next message
Satish Shrikhande
Messages: 167
Registered: October 2001
Senior Member
what is the err message ?

And look you are using INTO to get value of id FROM EMPLOYEE_GENERAL_INFO .I think the err is bcz of number of records in EMPLOYEE_GENERAL_INFO table so better you go for cursor .

Do you hvae only one record in EMPLOYEE_GENERAL_INFO then only it will work otherwise it will give err .

----------------------------------------------------------------------
Re: Compilation error [message #35706 is a reply to message #35702] Mon, 08 October 2001 08:10 Go to previous message
Hans
Messages: 42
Registered: September 2000
Member
create or replace trigger trg_ins_id
after delete or insert or update on employee_general_info
for each row
begin
 
   if deleting then   
    
      delete from basic_status
         where id = :old.id;
          
   elsif inserting then
    
      insert into basic_status ( id )
         values ( :new.id );
          
   else
    
      update basic_status set id = :new.id
         where id = :old.id;
          
   end if;
end;
/
show errors


----------------------------------------------------------------------
Previous Topic: delete script
Next Topic: update long column
Goto Forum:
  


Current Time: Sat May 25 15:28:45 CDT 2024