Getting ORA-04091 MUTATING TABLE ERROR
604091Oct 30 2007 — edited Nov 1 2007hi all
Please help me . i have create one function it is giving me ora-04091 when i m insert some values in the table on which function is associated
code of my function is as follow
create function get_curr_mgr_id (p_mgr_no number)
return number is
v_id number;
begin
select ID into v_id
from EMP_HCHY
where emp_no = p_mgr_no;
return v_id;
exception
when no_data_found then
v_id := null;
return v_id;
end;
INSERT INTO EMP_HCHY (ID,EMP_NO,TITLE_NM)
SELECT EMP_SEQ.NEXTVAL,
get_curr_mgr_id(CURR_MGR),
EMP_NO,
TITLE_NM
from STG_HCHY
start with TITLE_NM = 'VP'
connect by prior EMP_NO = curr_MGR
and TITLE_NM = decode( prior TITLE_NM ,
'VP','AVP', 'AVP','RSD', 'RSD','DSM', 'DSM','REP' )
i want to achieve
the sequence number of parent (ID) should be (curr_mgr)for its children in EMP_HCY TABLE