Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting ORA-04091 MUTATING TABLE ERROR

604091Oct 30 2007 — edited Nov 1 2007
hi 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 29 2007
Added on Oct 30 2007
6 comments
520 views