الانتقال إلى المحتوى

plsql


blackpanther9090

Recommended Posts

aslam wa alikom
iam student in india and i am studying oracle i just want to ask a question if i want to create a table same like emp and name it emp1
and if i insert ,delete or update anything in emp the same actoin has to appear in emp1 so what code should i right
for that
plz help me
at the end i want to thank evry one working on this site
asking god to help us all
if anyone can help me no problem he can write it arabic or english

رابط هذا التعليق
شارك

  • بعد 2 أسابيع...
  • بعد 6 شهور...

CREATE OR REPLACE TRIGGER AUDIT_WORK_ORDER
BEFORE INSERT OR UPDATE OR DELETE ON work_order
FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO AUDITING_WORK_ORDER
VALUES(NULL,:NEW.m_code,NULL,:NEW.w_o_code,NULL,
:NEW.w_o_qty,null,:NEW.w_o_startdate,null,:NEW.w_o_finshdate,USER,'inseting',SYSDATE);
ELSIF DELETING THEN
INSERT INTO AUDITING_WORK_ORDER 
VALUES(:OLD.m_code,NULL,:OLD.w_o_code,NULL,
:OLD.w_o_qty,NULL,:OLD.w_o_startdate,NULL,:OLD.w_o_finshdate,NULL,USER,'DELETING',SYSDATE);
ELSE
INSERT INTO AUDITING_WORK_ORDER 
VALUES(:OLD.m_code,:NEW.m_code,:OLD.w_o_code,
:NEW.w_o_code,:OLD.w_o_qty,:NEW.w_o_qty,:OLD.w_o_startdate,:NEW.w_o_startdate,:OLD.w_o_finshdate,:NEW.w_o_finshdate,USER,'UPDATING',SYSDATE);
END IF;
END;


هذا ما تريد
بس انت عدل و فنن

ايهاب وجدى

رابط هذا التعليق
شارك

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

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

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

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