Inserting data using a trigger [message #1669] |
Tue, 21 May 2002 03:03 |
Michael
Messages: 61 Registered: October 1999
|
Member |
|
|
Hi
i have to write a trigger that stores the values from a shareholder table, company table, sysdate and shares table(the many-many) between shareholder & company which holds the amount of shares owned by a shareholder for a company. this trigger has to fire when the details of the shareholder are updated or deleted.
thanks!
this is what i had
i get bad variable bind errors
create or replace trigger share_trig
before update or delete on shareholder
for each row
declare id integer;
begin
select
count(*) into id
from
company c,
shares sh,
dual
where
c.comp_id = sh.comp_id
AND sh.shareholderid=:old.shareholderid;
if (id>0) then
insert into
temp_table(num_char, char_col, num_col, num_col, sysdate)
values(
:old.comp_id,
:old.comp_name,
:old.shareAmount,
:old.shareholderid,
:old.sysdate);
end if;
end;
|
|
|
|