الانتقال إلى المحتوى
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.

مشكلة في Trigger

Featured Replies

بتاريخ:

انا عامل تريجر المفروض انة لما بيحصل اي تعديل في جدول الموظفين يتسجل في جدول تاريخ الموظفين بس المشكلة اني لما بعدل في جدول الموظفين بيديني خطا غريب جدا و بياخد وقت عقبال ما بيطلع الخطاء دة

و لما بيجيلي كدة باجي اشوف جدول تاريخ الموظفين بيقولي برضة تفس الخطاء بتاع المقبس دة ولازم اللغي اللي كتبتة و اعمل roll back علشان الجدول بتاع التاريخ يفتح ... حد ممكن يفيدني ؟؟؟

 

دة كود التريجر

create or replace trigger staff_his_update after update on staff for each row declare begin insert into staff_history (staff_his_id , his_staff_grade , his_staff_group , his_staff_vanguard , his_staff_vanguard_grade , his_staff_registry , his_staff_id, his_staff_update_date ) select sraff_his_id_seq.nextval ,staff_grade , staff_group , staff_vanguard , staff_vanguard_geade , staff_registry , staff_id , sysdate from staff where staff_id = : old.staff_id ; end;

و الخطاء اللي بيطلع موجود في الصورة

post-133555-0-43556700-1380046042_thumb.jpg

بتاريخ:

السلام عليكم

ممكن تجرب الكود التالي:

 

CREATE OR REPLACE TRIGGER staff_his_update
   AFTER UPDATE
   ON staff
   REFERENCING NEW AS NEW OLD AS OLD
   FOR EACH ROW
BEGIN
   IF UPDATING
   THEN
      INSERT INTO staff_history
                  (staff_his_id, his_staff_grade, his_staff_group,
                   his_staff_vanguard, his_staff_vanguard_grade,
                   his_staff_registry, his_staff_id, his_staff_update_date)
         SELECT sraff_his_id_seq.NEXTVAL,
                staff_grade,
                staff_group,
                staff_vanguard,
                staff_vanguard_geade,
                staff_registry,
                staff_id,
                SYSDATE
           FROM staff
          WHERE staff_id = :OLD.staff_id;
   END IF;
END;
بتاريخ:
  • كاتب الموضوع

شكرا علي المساعدة ... بس انا لما كتبت الكود دة اداني 3 اخطاء ora-04091 / ora-06512 / ora-04088

و لما دورت علي النت عرفت انهم هم ال3 بيجوا مع بعض و السبب ان الترجر مش عارف يقري الجدوال اة حاجة في الجدول و بيقول ان الحل انك تمسح الترجل و تكتبة تاني بس المشكلة اني بعد ما عملت كدة برضة المشكلة موجودة

بتاريخ:

السلام عليكم

هذه معنى الاخطاء ولكن جرب اضف كلمة Commit مباشرة بعد جملة الـ Insert واخبرني بالنتيجة.

ora-06512 numeric or value error

ora 04088 no data found

ora-04091 table is mutating trigger/function may not see it
  • بعد 1 شهر...
بتاريخ:

جرب تستخدم old.column  في كل الاعمده من غير select

بتاريخ:

 


CREATE OR REPLACE TRIGGER staff_his_update
   AFTER UPDATE
   ON staff
   REFERENCING NEW AS NEW OLD AS OLD
   FOR EACH ROW
BEGIN
   IF UPDATING
   THEN
      INSERT INTO staff_history
                  (staff_his_id, his_staff_grade, his_staff_group,
                   his_staff_vanguard, his_staff_vanguard_grade,
                   his_staff_registry, his_staff_id, his_staff_update_date)
         VALUES( sraff_his_id_seq.NEXTVAL,
                :NEW.staff_grade,
                :NEW.staff_group,
                :NEW.staff_vanguard,
                :NEW.staff_vanguard_geade,
                :NEW.staff_registry,
                :NEW.staff_id,
                SYSDATE);
   END IF;
END;

 

بتاريخ:

 

CREATE OR REPLACE TRIGGER staff_his_update
   AFTER UPDATE
   ON staff
   REFERENCING NEW AS NEW OLD AS OLD
   FOR EACH ROW
BEGIN
   IF UPDATING
   THEN
      INSERT INTO staff_history
                  (staff_his_id, his_staff_grade, his_staff_group,
                   his_staff_vanguard, his_staff_vanguard_grade,
                   his_staff_registry, his_staff_id, his_staff_update_date)
         VALUES( sraff_his_id_seq.NEXTVAL,
                :NEW.staff_grade,
                :NEW.staff_group,
                :NEW.staff_vanguard,
                :NEW.staff_vanguard_geade,
                :NEW.staff_registry,
                :NEW.staff_id,
                SYSDATE);
   END IF;
END;

 

i think he wanna keep the old not the new ??

بتاريخ:

Replace new of old.columnname

بتاريخ:

الحالة اللي صارت تسمى muteted table هي انك تعمل insert  و update  على نفس record.

بتاريخ:

رقم الايرور ايه في جملتك الاولي خالص ؟

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

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

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

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

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

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.