|
I am newbie in DB2 and created the following Trigger, to update the EMP2 table Hierarchy, whenever update query is run on that table, but whenver I run the update query, it takes much time, atleast 5 minutes, when table has only 5 records. I have created this trigger with the help of IBM Examples on Internet, don't know what am I missing, do I have to use both NEW and OLD Keywords or something else. Please help me out. Best Regards, Luqman Here is the trigger. CREATE TRIGGER trg_employees_u_calchierarchy AFTER UPDATE ON EMP2 REFERENCING NEW AS NEW_EMP FOR EACH ROW MODE DB2SQL UPDATE EMP2 X set HIERARCHY= (SELECT B.Hierarchy|| '.'||TRIM(CHAR(A.empid)) FROM Emp2 A, EMP2 B WHERE A.MGRID = B.EMPID AND A.EMPID=X.EMPID) WHERE X.EMPID=NEW_EMP.EMPID
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.