الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

تريغر بسيط مع خطا ORA-04091: table string.string is mutating

Featured Replies

بتاريخ:

اخواني عند تنفيذ هذا التريغر البسيط والتافه

CREATE OR REPLACE TRIGGER  status_terminated_date
after UPDATE ON employees
FOR EACH ROW
BEGIN if :new.status = 2 then 

update employees
set terminated_date =to_char(sysdate,'dd/mm/yyyy')
where emp_id=:old.emp_id;
end if;
END;


يشتغل تمام
ولكن عند عمل تعديل على قيمة status =2 يعطيني الخطا التالي

يعطيني الخطا التالي

ORA-04091: table string.string is mutating, trigger/function may not see it
Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.

شو الحل لانو جنني ومن الصبح وانا بلشان فيه

بتاريخ:
  • كاتب الموضوع

اخواني طبعا هذا الخطأ يحدث عندما تريد ان تنفذ جمل dml اثناء التواجد في الجدول وهذا لا يجوز
وبالتالي يجب التحايل بطرق اخرى على الموضووع
انا قمت بتبديل الكود واشتغل تمام وهو كالتالي كي يستفيد الكل منه

CREATE OR REPLACE TRIGGER  status_terminated_date
before  UPDATE ON employees
FOR EACH ROW
BEGIN if :new.status = 2 then 
:new.terminated_date:=sysdate;

end if;
END;

بتاريخ:

الأخ / ماهر

شكرا لك .. على ايضاح مشكلة ال mutating

اليك مشاركات سابقة بالمنتدى عن هذا الموضوع
وملفات مرفقه عن طرق تجنب ال mutating

إضغط هنا : Problem In Trigger ... mutating

بتاريخ:
  • كاتب الموضوع
الأخ / ماهر

شكرا لك .. على ايضاح مشكلة ال mutating

اليك مشاركات سابقة بالمنتدى عن هذا الموضوع
وملفات مرفقه عن طرق تجنب ال mutating

إضغط هنا : Problem In Trigger ... mutating

مشكور اخوي امجد ومنكم نستفيد

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.