Re: How Can I do This

From: Chakravarthy Nalamotu <kittu_at_gis.eng.hawaii.edu>
Date: 1996/10/28
Message-ID: <55328h$27r_at_news.Hawaii.Edu>#1/1


You cannot do this since your GL.ACCODE table is mutating. You must be using a row trigger to perform this transaction. But, there is a work around. Declare package variables and store the information that you want to insert into PERBAL table in these varaibles. Then use a statement trigger and insert the values in the PERBAL table. Statement triggers do not raise the mutating error for obvious reasons.
Let me know if you need further help with this. Thanks,
  Kittu.

: Pno NUMBER(2),
: CONSTRAINT Fk_AccDep FOREIGN KEY(Accode,Dep) REFERENCES
: AcCode(AcCode,Dep) ON DELETE CASCADE,
: CONSTRAINT Pk_ADYN PRIMARY KEY(AcCode,Dep,Yno,Pno));

: /* TRIGGER ON AcCode Table */
 

: CREATE OR REPLACE TRIGGER Trig_AcCode_AI
: AFTER INSERT ON AcCode
: FOR EACH ROW
: DECLARE
: CURSOR CurPeriod IS SELECT yno,pno FROM Period;
: BEGIN
: FOR x IN CurPeriod LOOP
: INSERT INTO PERBAL (accode,dep,yno,pno)
: VALUES (:NEW.accode,:NEW.dep,x.Yno,x.Pno);
: END LOOP;
: END;
Received on Mon Oct 28 1996 - 00:00:00 CET

Original text of this message