Flex Trggers After statement
Hello i am a newbie who needs urgent help i keep getting the below failure on my databridge.
java.lang.Exception: Record Key = (OBJ_CODE, 10617), (OBJ_ORG, *). System error:class com.dstm.mp.mpentitycollection.EntityCollectionSys temError: Error in processing entity DBError Error in updating R5Objects table: java.sql.SQLException: ORA-04091: table ADMIN0134_TRN.R5OBJECTS is mutating, trigger/function may not see it ORA-06512: at "ADMIN0134_TRN.TSCALC", line 190 ORA-06512:
I understand now why this is happening but i am having trouble writing the after statement in my code can anyone look at the below flex trigger and see how to write in an after statement to fire the trigger after the table is updated.
Description - When an Asset is Blancco'ed there can be sub assets attached to
the main asset. Each sub asset with be created via Databridge. This flex trigger
will connect the Main Asset to the Sub Asset Structures
Table - R5PROPERTYVALUES
Type - POST-INSERT
*/
Declare
v_subasset varchar2(255);
v_mainasset varchar2(255);
v_subobjtype varchar2(255);
v_subobjrtype varchar2(255);
v_subobjorg varchar2(255);
v_mainobjtype varchar2(255);
v_mainobjrtype varchar2(255);
v_mainobjorg varchar2(255);
Begin
select substr(prv_code, 1, instr(prv_code,'#',1,1)-1), prv_value into v_subasset, v_mainasset
from r5propertyvalues
where
prv_property = 'ABLAUID'
and
rowid = :rowid;
select obj_obtype, obj_obrtype, obj_org
into v_subobjtype, v_subobjrtype, v_subobjorg
from r5objects
where
obj_code = v_subasset;
select obj_obtype, obj_obrtype, obj_org
into v_mainobjtype, v_mainobjrtype, v_mainobjorg
from r5objects
where
obj_code = v_mainasset;
insert into r5structures
(STC_CHILDTYPE, STC_CHILDRTYPE, STC_CHILD, STC_PARENTTYPE, STC_PARENTRTYPE,
STC_PARENT, STC_ROLLDOWN, STC_ROLLUP, STC_EQUIVALENT, STC_DOWNTIME,
STC_CHILD_ORG, STC_PARENT_ORG)
Values
(v_subobjtype, v_subobjrtype, v_subasset, v_mainobjtype, v_mainobjrtype,
v_mainasset, '-', '+', '-', '-', v_subobjorg, v_mainobjorg);
exception
when no_data_found then
Null;
End;
Regards
Chris
|