|
-
Chris,
Thanks, your critiques is very helpful.
A lot of codes are generated by migration workbench during conversion, I haven't got time to clean it up. Right now, I'm only trying to make it work.
I will definitely spend sometime to read your comment again.
Also would you please help me looking at this trigger, I changed to:
declare
stoo_selcnt integer;
stoo_error integer;
stoo_rowcnt integer := 1;
stoo_crowcnt integer := 0;
stoo_fetchstatus integer := 0;
stoo_errmsg varchar2(255);
stoo_sqlstatus integer;
num_of_rows number(10,0);
noruntrg number(1);
v_next_id integer;
v_keypart1_use varchar(16);
v_keypart1indic integer;
v_keypart2_use varchar(16);
v_keypart2indic integer;
v_keypart3_use varchar(16);
v_keypart3indic integer;
begin
num_of_rows := stoo_rowcnt ;
if num_of_rows = 0 then
return ;
end if ;
begin
noruntrg := checkruntrigger ;
if (noruntrg = 1) then
begin
dbms_output.put_line('trigger is bypassed') ;
return ;
end;
end if ;
end ;
select count(*) into num_of_rows
from mdsvendors v
where :new.vendorid=v.vendorid;
if num_of_rows=0 then
begin
RAISE_APPLICATION_ERROR(-20500,'Trigger forces a rollback');
ROLLBACK ;
raise_application_error(-20999, 3100 || '-' || 'Unable to insert.');
return;
end;
end if;
select next_id into v_next_id
from next_id
where table_name='Platforms';
:new.platformid:=v_next_id+1;
update next_id
set next_id=next_id+1
where table_name='Platforms';
if (nvl(:new.keypart1_use,'nothing') = 'nothing') then
v_keypart1indic := 0;
else
v_keypart1indic := 1;
end if;
if (nvl(:new.keypart2_use,'nothing') = 'nothing') then
v_keypart2indic := 0;
else
v_keypart2indic := 1;
end if;
if (nvl(:new.keypart3_use,'nothing') = 'nothing') then
v_keypart3indic := 0;
else
v_keypart3indic := 1;
end if;
insert into platformmapkeys( platformid, keypart1indic, keypart2indic, keypart3indic )
select platformid, v_keypart1indic, v_keypart2indic, v_keypart3indic
from platforms
where platform=:new.platform;
end tri_platforms;
It works when I try to insert into table Platforms, the Platformid is inserted through this trigger. However, the last "insert into platformmapkeys" was not successful, ie. no record is inserted nor any error message.
I suspect that whether the table 'Platforms' table is mutating since a record is just inserted and at the same time it is performing insert into 'platformmapkeys' using 'platformid'? Please advise.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|