Can someone help me correct the Trigger below? I am assigned this problem but my technical skill is limited.
My script hit the error below (ORA 4091):
Processing STANDARD PO Number: 27179
......................................
Updating PO Status..
Done Approval Processing.
dist id 611294gl amount 10000.88 bill_del_amount 0 l_amount 10000.88
some exception occured **ORA-04091: table PO.PO_DISTRIBUTIONS_ALL is mutating,
trigger/function may not see it**
ORA-06512: at "APPS.XXAET_PO_DELIVER_TO_TRG",
line 22
ORA-01403: no data found
ORA-04088: error during execution of trigger
'APPS.XXAET_PO_DELIVER
PL/SQL procedure successfully completed.
SQL>
I manage to find the customized trigger in clients machine, but after researching I am unable to pin point whats wrong with the sql . Please HELP!
CREATE OR REPLACE TRIGGER apps.xxaet_po_deliver_to_trg
BEFORE INSERT OR UPDATE ON po_distributions_all
FOR EACH ROW
DECLARE
l_emp_name VARCHAR2 (300);
l_sqlcode VARCHAR (30) := SQLCODE;
l_sqlerrm VARCHAR (400) := SUBSTR (SQLERRM, 1, 399);
x_profile_value VARCHAR (10) ;
BEGIN
x_profile_value := fnd_profile.value('ORG_ID');
Select Ship_To_Location_ID
INTO :NEW.Deliver_To_Location_Id
from PO_LINE_LOCATIONS_ALL
WHERE line_location_id = :NEW.line_location_id
AND ORG_ID = x_profile_value
;
EXCEPTION
WHEN OTHERS
THEN
NULL;
UPDATE PO_DISTRIBUTIONS_ALL SET Deliver_To_Location_Id = :NEW.Deliver_To_Location_Id
WHERE line_location_id = :NEW.line_location_id;
END;
/
Thank you so much! Kenneth.