How to get around ora-ORA-04091: table SSBOSS.SSTRMAST is mutating, trigger

hi,
Does anyone know how one would get around this problem please ?
Here is my dbase trig:
CREATE OR REPLACE TRIGGER SSBOSS.new_not_greater_than_net
BEFORE INSERT OR UPDATE OF newrent ON SSBOSS.SSTRMAST
REFERENCING NEW AS new OLD AS old
FOR each row
DECLARE
not_permitted EXCEPTION;
vnum number := ssboss.nik_f;
BEGIN
IF :new.NEWRENT > vnum then
--AND :old.DELETED = 'N' THEN
RAISE not_permitted;
END IF;
EXCEPTION
WHEN not_permitted THEN
RAISE_APPLICATION_ERROR
(-20001, 'NEWRENT:'||:new.newrent||' '||'OLDRENT:'||' '||:old.netrent||'Action not permitted. Contribution (sstrmast.newrent) value '
||:new.NEWRENT
||' exceeds GROSS rental value (sstrmast.netrent) ');
END;
Here is my problem:
SQL> update sstrmast set newrent = 11;
update sstrmast set newrent = 11
ERROR at line 1:
ORA-04091: table SSBOSS.SSTRMAST is mutating, trigger/function may not see it
ORA-06512: at "SSBOSS.NIK_F", line 4
ORA-06512: at "SSBOSS.NEW_NOT_GREATER_THAN_NET", line 4
ORA-04088: error during execution of trigger 'SSBOSS.NEW_NOT_GREATER_THAN_NET'
I understand why but not how to correct?
Thanks,
nikolia.

Hello,
This problem as you might be knowing occurs when you try to select the data from the same table on which the trigger is written. Also this problem is only with the row level trigger and not with the statement level trigger. However the limitation of the statement level trigger is it can not refer to :NEW or :OLD. So now the solution is to capture the value of :NEW or :OLD in the row level trigger (no select statement here) and store it in some global variable. And how do you get the global variable? Using package specification ! a variable declared in a package specification is global in nature. Then use the value so stored in the statement level trigger in the select statement. It will work. Other solution is to use pragma autonomous transaction. Try and let us know. All the best.
Regards

Similar Messages

  • ORA-04091: table ...is mutating, trigger/function may

    when I run a delete on this table I have the error
    ORA-04091: table MICRODEV.T086_LIEN_INSC is mutating, trigger/function may not see it
    ORA-06512: at "MICRODEV.TG_DEL_T086_LIEN_INSC", line 5
    ORA-04088: error during execution of trigger 'MICRODEV.TG_DEL_T086_LIEN_INSC'
    How Can I workaround it
    CREATE OR REPLACE TRIGGER "MICRODEV"."TG_DEL_T086_LIEN_INSC"
    BEFORE
    DELETE ON "MICRODEV"."T086_LIEN_INSC" FOR EACH ROW DECLARE lNbRows NUMBER(1);
    BEGIN
    IF :OLD.CO_PART_DNOM_SOC = 'DS' THEN
    SELECT 1 INTO lNbRows
    FROM T086_LIEN_INSC
    WHERE NO_SEQ_LIEN_DNOM = :OLD.NO_SEQ_LIEN_INSC
    AND NO_INSC = :OLD.NO_INSC
    AND CO_PART_DNOM_SOC <> 'PA';
    IF lNbRows = 1 THEN
    raise_application_error(-20100, 'TRIGGER On Delete (T086_LIEN_INSC)');
    END IF;
    SELECT 2 INTO lNbRows
    FROM T086_LIEN_INSC
    WHERE NO_SEQ_LIEN_DNOM = :OLD.NO_SEQ_LIEN_INSC
    AND NO_INSC = :OLD.NO_INSC
    AND CO_PART_DNOM_SOC = 'PA';
    IF lNbRows = 2 THEN
    raise_application_error(-20101, 'TRIGGER On Delete (T086_LIEN_INSC)');
    END IF;
    END IF;
    END;

    when I run a delete on this table I have the error
    ORA-04091: table MICRODEV.T086_LIEN_INSC is mutating, trigger/function may not see it
    ORA-06512: at "MICRODEV.TG_DEL_T086_LIEN_INSC", line 5
    ORA-04088: error during execution of trigger 'MICRODEV.TG_DEL_T086_LIEN_INSC'
    How Can I workaround it
    CREATE OR REPLACE TRIGGER "MICRODEV"."TG_DEL_T086_LIEN_INSC"
    BEFORE
    DELETE ON "MICRODEV"."T086_LIEN_INSC" FOR EACH ROW DECLARE lNbRows NUMBER(1);
    BEGIN
    IF :OLD.CO_PART_DNOM_SOC = 'DS' THEN
    SELECT 1 INTO lNbRows
    FROM T086_LIEN_INSC
    WHERE NO_SEQ_LIEN_DNOM = :OLD.NO_SEQ_LIEN_INSC
    AND NO_INSC = :OLD.NO_INSC
    AND CO_PART_DNOM_SOC <> 'PA';
    IF lNbRows = 1 THEN
    raise_application_error(-20100, 'TRIGGER On Delete (T086_LIEN_INSC)');
    END IF;
    SELECT 2 INTO lNbRows
    FROM T086_LIEN_INSC
    WHERE NO_SEQ_LIEN_DNOM = :OLD.NO_SEQ_LIEN_INSC
    AND NO_INSC = :OLD.NO_INSC
    AND CO_PART_DNOM_SOC = 'PA';
    IF lNbRows = 2 THEN
    raise_application_error(-20101, 'TRIGGER On Delete (T086_LIEN_INSC)');
    END IF;
    END IF;
    END;

  • ORA-04091: table ... is mutating, trigger/function may not see it

    Hi,
    I keep getting this error message for my trigger when performing an
    insert..select statement (standard plain old insert works):
    ORA-04091: table ... is mutating, trigger/function may not see it
    The trigger is as follows:
    CREATE OR REPLACE TRIGGER MYTABLE_BEF_INS_CHECK
    BEFORE INSERT ON MYTABLE
    DECLARE
    v_o_id number(10);
    BEGIN
    IF :new.TYP = 'O' THEN
    SELECT 1
         INTO v_o_id
         FROM MYTABLE WHERE TYP = 'O' AND ID=:new.ID;
    END IF;
    END;
    The thing is the trigger works fine for a standard insert like:
    insert into MYTABLE( id,typ)
    values(426672,'O')
    No problem the above works. But when I try an insert select..it
    fails.
    insert into MYTABLE( id,typ)
    SELECT x_id, 'O' from AnyOtherTable;
    the above will fail.
    Anyone an idea why this is the case??
    thx.

    Hi,
    OK OK !!!! This was a copy/paste error. FOR EACH ROW was just not pasted here. Full trigger again:
    CREATE OR REPLACE TRIGGER MYTABLE_BEF_INS_CHECK
    BEFORE INSERT ON MYTABLE
    for each row
    DECLARE
    v_o_id number(10);
    BEGIN
    IF :new.TYP = 'O' THEN
    SELECT 1
         INTO v_o_id
         FROM MYTABLE WHERE TYP = 'O' AND ID=:new.ID;
    END IF;
    END;
    But I want to know why I DO NOT get this problem with the standard insert statement but only with the insert...select.
    thx.
    S.

  • ORA-04091 table string.string is mutating, trigger/function may not see it

    When I am tending to delete something from my table I received this message.
    I defined a PL/SQL function reads data from that table. Is that meaning I could not modify anything in table once I have some PL/SQL defined on that? It sounds ridiculour. Or I missed some points?
    Anyone could help me out?
    Many thanks,
    Qiang

    In get_point_coordinates(point_id, layerid), it does not have any codes deleting thing from point_tab.
    Its functionality is to find out that specified point;
    put its coordinates into SDO_GEOMETRY object and return as function value.
    However, oracle does not allow me to delete any data from point table since then.It is saying that function (get_point_coordinates) can not know mutating tables.
    When I run delete task:
    delete from point$_view where point_id = 1;
    I got errors:
    ERROR at line 1:
    ORA-04091: table POINT$_TABLE is mutating, trigger/functio
    n may not see it
    ORA-06512: at "GET_POINT_COORDINATES", /* THIS LINE REPORS ERROR*/ Look at codes below.
    The following is code of function: GET_POINT_COORDINATES
    FUNCTION GET_POINT_COORDINATES(pPoint_ID IN NUMBER, player_ID IN NUMBER)
    RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC IS
    PSRID NUMBER :=NULL:
    PLON NUMBER := NULL;
    PLAT NUMBER := NULL;
    CURSOR get_lonlat(ppoint_id IN NUMBER, player_id IN NUMBER) IS SELECT LON,LAT
    FROM POINT$_VIEW /* THIS LINE REPORS ERROR*/
    WHERE player_id = layer_id AND ppoint_id = point_id;
    BEGIN
    PSRID := 8265;
    OPEN get_lonlat(pPoint_ID,Player_ID);
    FETCH get_lonlat INTO PLON, PLAT;
    RETURN MDSYS.SDO_GEOMETRY(2001,PSRID,MDSYS.SDO_POINT_TYPE(PLON,PLAT,NULL),NULL ,NULL);
    END GET_POINT_GEOM;
    I guess it has nothing with foreign key. There is something wrong with this function.
    By the way, a spatail index is built on this function. Does this make any differences on this point?

  • Getting ORA-04091: table SALUSER.PRM_M_EMPLOYEE is mutating, trigger/

    create or replace trigger prm_tr_emp_active
    before  update or insert on  prm_m_employee
    referencing NEW as new_data  OLD as old_data
    for each row
    declare
        v_tag       number ;
         --PRAGMA AUTONOMOUS_TRANSACTION;
    begin
        select NVL2( PMEP_FATHER_NAME, 1, 0) * NVL2( PMEP_MOTHER_NAME, 1, 0) *
               NVL2( PMEP_NATIONALITY, 1, 0) * NVL2( PMEP_RELIGION_CODE, 1, 0)*
               NVL2( PMEP_SEX, 1, 0) * NVL2( PMEP_DOB, 1, 0) * NVL2( PMEP_QUALIFICATION, 1, 0) *
               NVL2( PMEP_APPOINTMENT_TYPE, 1, 0) * NVL2( PMEP_DESIGNATION, 1, 0) *
               NVL2( PMEP_DOJ, 1, 0) * NVL2( PMEP_LOCATION_CODE, 1, 0) * NVL2( PMEP_SKILL_CODE, 1, 0) *
               NVL2( PMEP_GRADE_CODE, 1, 0) * NVL2( PMEP_ONSITE_TAG, 1, 0) * NVL2( PMEP_NIL_SALARY_TAG, 1, 0) *
               NVL2( PMEP_HOLD_EBC_TAG, 1, 0) * NVL2( PMEP_EX_SERVICE_MAN, 1, 0) *
               NVL2( PMEP_NRI_STATUS, 1, 0) * NVL2( PMEP_PAYMENT_CURRENCY, 1, 0) *
               NVL2( PMEP_TAX_BY_COMPANY, 1, 0) * NVL2( PMEP_FNF_SETTLED, 1, 0) *
               NVL2( PMEP_PAN_NO, 1, 0)  * NVL2( PMEP_STATE_CODE, 1, 0) * NVL2( PMEP_MARITAL_STATUS, 1, 0)*
               NVL2( PMEP_SAF_MEMBER, 1, 0) * NVL2( PMEP_SAF_THRU_SALARY, 1, 0) *
               NVL2( PMEP_SAF_ENCASHMENT, 1, 0) * NVL2( PMEP_TDS_ON_PF_INT, 1, 0) *
               NVL2( PMEP_PROCESS_BY_SSC, 1, 0) * NVL2( PMEP_CITY_CODE, 1, 0)
        into v_tag
        from prm_m_employee
        where pmep_emp_id = :new_data.pmep_emp_id ;
           if v_tag = 1 then
                update prm_m_employee set
                 pmep_active = 'Y'
                where pmep_emp_id =  :new_data.pmep_emp_id ;
           else
                update prm_m_employee set
                 pmep_active = 'N'
                where pmep_emp_id =  :new_data.pmep_emp_id ;      
           end if ;
        --COMMIT;    
    end ;

    Assuming that pmep_emp_id is the primary key of the table, it doesn't appear that you need to do a SELECT against the table or an UPDATE against the table. If that is the primary key, then you should just need to manipulate the :new.column_name values for the row you are modifying, i.e.
    v_tag := NVL2( :new.pmep_father_name, 1, 0 ) * NVL2( :new.pmep_mother_name, 1, 0 ) *
             NVL2( :new.pmep_nationality, 1, 0 ) * ...
    IF( v_tag = 1 )
    THEN
      :new.pmep_active := 'Y';
    ELSE
      :new.pmep_active := 'N';
    END IF;You would absolutely want to avoid trying to use an autonomous transaction here. The autonomous transaction would not be able to see data inserted by the current transaction and commits happen outside the scope of the calling transaction. Barring a logging operation where you want the log to remain even if the logging event is rolled back (i.e. log attempts to delete a row even if the attempt fails), you should not use autonomous transactions in triggers. And you should not be using autonomous transactions to work around mutating trigger errors.
    Justin
    Edited by: Justin Cave on Mar 11, 2009 2:23 AM

  • ORA-04091: table CCS.T_PROCESSLOG is mutating, trigger/function may not see it

    I have a problem. Here is a trigger that I'm working with.
    CREATE OR REPLACE TRIGGER Trgedw_extract
    AFTER INSERT OR UPDATE OF completioncode ON CCS.t_processlog
    FOR EACH ROW
    WHEN ( (OLD.filename = 'ACCTINFO') AND (OLD.completioncode = 1) )
    BEGIN
    CCS.Edwextract;
    END;The t_processlog table has a field (processid) that is the primary key. However the processid wasn't setup as a sequence number directly through Oracle. It was set up as a sequence number through a trigger. (Don't ask...)
    The code for the procedure that the code above call is here.
    CREATE OR REPLACE PROCEDURE Edwextract AS
    Jobname: Edwextract
    Author: Adam Bolduc
    Date: 6/18/2001
    Purpose: To run the monthly jobs (ccs.populateedw92, ccs.populateedw54) to
    populate the t_edw table and export the data to a flat file on the system.
    This file will be sent to edw. Then drop and recreate the index on the t_edw table
    to access the data faster.
    EDW92 EXCEPTION;
    EDW54 EXCEPTION;
    PUTLINE_ERROR EXCEPTION;
    FILE_OPEN_ERROR EXCEPTION;
    FILE_CLOSE_ERROR EXCEPTION;
    DROP_INDEX_FLAG EXCEPTION;
    CREATE_INDEX_FLAG EXCEPTION;
    dPid ccs.t_processlog.PROCESSID%TYPE;
    szdata_rec CHAR(1436);
    outfile_name VARCHAR2(50) DEFAULT 'edw.txt';
    outfile_dir VARCHAR2(100) DEFAULT '/scratch/edw/';
    outfile_handle UTL_FILE.file_type;
    szSQLErrText VARCHAR2(250);
    iRetValue PLS_INTEGER;
    icursor_name INTEGER;
    irows_processed INTEGER;
    dtDateProcess ccs.t_processlog.PROCESSDATE%TYPE;
    CURSOR edw_extract_cur IS
    SELECT
    ccs.t_edw.RECORDIDENTIFIER&#0124; &#0124;
    ccs.t_edw.TSYSVERSIONINDICATOR&#0124; &#0124;
    ccs.t_edw.TS1CREDITRATING&#0124; &#0124;
    ccs.t_edw.TS1BILLINGTYPE&#0124; &#0124;
    ccs.t_edw.TS1PROCESSTYPE&#0124; &#0124;
    ccs.t_edw.TS1BANKNUMBER&#0124; &#0124;
    ccs.t_edw.TS1AGENTBANKNUMBER&#0124; &#0124;
    ccs.t_edw.PRODUCTCODE&#0124; &#0124;
    ccs.t_edw.CLIENTPRODUCTCODE&#0124; &#0124;
    ccs.t_edw.TRACKINGNUMBER&#0124; &#0124;
    ccs.edwaccountencrypt(ccs.t_edw.ACCOUNTNUMBER)&#0124; &#0124;
    ' '&#0124; &#0124;
    ccs.t_edw.NAMEPRIMARY&#0124; &#0124;
    ccs.t_edw.NAMECOAPP&#0124; &#0124;
    ccs.t_edw.ADDRESSLINE1&#0124; &#0124;
    ccs.t_edw.ADDRESSLINE2&#0124; &#0124;
    ccs.t_edw.CITY&#0124; &#0124;
    ccs.t_edw.STATEPROVINCECODE&#0124; &#0124;
    ccs.t_edw.ZIPCODE&#0124; &#0124;
    ccs.edwssnencrypt(ccs.t_edw.SSN)&#0124; &#0124;
    ccs.t_edw.HOMEPHONENUMBER&#0124; &#0124;
    ccs.t_edw.PHOTOCARDINDICATOR&#0124; &#0124;
    ccs.t_edw.ACCOUNTTYPE&#0124; &#0124;
    NVL(ccs.t_edw.InsuranceType , '000' )&#0124; &#0124;
    ccs.t_edw.ASSETPOOLNUMBER&#0124; &#0124;
    ccs.t_edw.STATEMENTHOLDCODE&#0124; &#0124;
    ccs.t_edw.BRANCHNUMBER&#0124; &#0124;
    ccs.t_edw.BANKRUPTCYPREDICTORSCORE&#0124; &#0124;
    ccs.t_edw.DATELASTBANKRUPTCYRESCORE&#0124; &#0124;
    NVL(ccs.t_edw.DATEOPEN,'0000000')&#0124; &#0124;
    ccs.t_edw.DATEEXPIRATION&#0124; &#0124;
    ccs.t_edw.DATECUSTOMERBIRTH&#0124; &#0124;
    ccs.t_edw.DATECLOSEDVOLUNTARY&#0124; &#0124;
    ccs.t_edw.DATECLOSEDINVOLUNTARY&#0124; &#0124;
    ccs.t_edw.DATELASTACTIVE&#0124; &#0124;
    ccs.t_edw.DATELASTPAYMENT&#0124; &#0124;
    ccs.t_edw.DATELASTPURCHASE&#0124; &#0124;
    ccs.t_edw.DATECHARGEOFF&#0124; &#0124;
    NVL(ccs.t_edw.DateLastStatement , '0000000' )&#0124; &#0124;
    ccs.t_edw.DATEHIGHESTBALANCELTD&#0124; &#0124;
    ccs.t_edw.DATELASTCREDITLIMITCHANGE&#0124; &#0124;
    ccs.t_edw.STATUSCLOSED&#0124; &#0124;
    ccs.t_edw.STATUSCREDITREVOKED&#0124; &#0124;
    ccs.t_edw.STATUSPASTDUE&#0124; &#0124;
    ccs.t_edw.STATUSCHARGEOFF&#0124; &#0124;
    NVL(ccs.t_edw.StatusSkipPayment , ' ' )&#0124; &#0124;
    ccs.t_edw.CHARGEOFFTYPE&#0124; &#0124;
    NVL(ccs.t_edw.MinimunPaymentDue , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.CURRENTBALANCE&#0124; &#0124;
    NVL(ccs.t_edw.PreviousStatementBalance , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.BALANCECHARGEDOFF&#0124; &#0124;
    ccs.t_edw.CURRENTCREDITLIMIT&#0124; &#0124;
    ccs.t_edw.ORIGINALCREDITLIMIT&#0124; &#0124;
    NVL(ccs.t_edw.BalancePastDueCycle , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.HIGHESTBALANCELTD&#0124; &#0124;
    NVL(ccs.t_edw.AnnualFeeCharge , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.AVAILABLEMONEY&#0124; &#0124;
    ccs.t_edw.NUMCREDITLIMITINCREASES&#0124; &#0124;
    ccs.t_edw.NUMCREDITLIMITDECREASES&#0124; &#0124;
    NVL(ccs.t_edw.APRPurchases , '000000' )&#0124; &#0124;
    NVL(ccs.t_edw.APRCash , '000000' )&#0124; &#0124;
    NVL(ccs.t_edw.APROldPurchases , '000000' )&#0124; &#0124;
    ccs.t_edw.APRBALTRANSFER1&#0124; &#0124;
    NVL(ccs.t_edw.APRPromoCash , '000000' )&#0124; &#0124;
    NVL(ccs.t_edw.APRPromoPurchases , '000000' )&#0124; &#0124;
    ccs.t_edw.APRBALTRANSFER2&#0124; &#0124;
    NVL(ccs.t_edw.RateTypePurchases , ' ' )&#0124; &#0124;
    NVL(ccs.t_edw.RateTypeCash , ' ' )&#0124; &#0124;
    ccs.t_edw.RATETYPEOLDPURCHASES&#0124; &#0124;
    ccs.t_edw.RATETYPEBALTRANSFER1&#0124; &#0124;
    ccs.t_edw.RATETYPEPROMOCASH&#0124; &#0124;
    ccs.t_edw.RATETYPEPROMOPURCHASES&#0124; &#0124;
    ccs.t_edw.RATETYPEBALTRANSFER2&#0124; &#0124;
    NVL(ccs.t_edw.ADBPurchases , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.ADBCash , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.ADBOLDPURCHASES&#0124; &#0124;
    ccs.t_edw.ADBBALTRANSFER1&#0124; &#0124;
    ccs.t_edw.ADBPROMOCASH&#0124; &#0124;
    ccs.t_edw.ADBPROMOPURCHASES&#0124; &#0124;
    ccs.t_edw.ADBBALTRANSFER2&#0124; &#0124;
    ccs.t_edw.ASSESSEDFEEANNUAL&#0124; &#0124;
    NVL(ccs.t_edw.AssessedFeeCash , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.AssessedFeeFinanceCharges, '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.AssessedFeeInsurance , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.AssessedFeeLate , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.AssessedFeeOverlimit , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.ASSESSEDFEERETURNEDCHECK&#0124; &#0124;
    NVL(ccs.t_edw.BilledTotalDollars , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.BilledPurchases , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.BilledCash , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.BILLEDOLDPURCHASES&#0124; &#0124;
    ccs.t_edw.BILLEDBALTRANSFER1&#0124; &#0124;
    ccs.t_edw.BILLEDPROMOCASH&#0124; &#0124;
    ccs.t_edw.BILLEDPROMOPURCHASES&#0124; &#0124;
    ccs.t_edw.BILLEDBALTRANSFER2&#0124; &#0124;
    ccs.t_edw.BILLEDMISC&#0124; &#0124;
    NVL(ccs.t_edw.BilledFinanceCharges , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesPurchases , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesCashAdvances , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.NEWCHARGESCONVCHECK&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesATM , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.NEWCHARGESBALXFERPURCH&#0124; &#0124;
    ccs.t_edw.NEWCHARGESBALXFERCHECK&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesFinanceCharges , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesCashFees , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesInsuranceFees , '000000000000000' )&#0124; &#0124;
    ccs.t_edw.NEWCHARGESRETURNEDCHECKS&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesOverlimitFees , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesPurchaseFC , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesCashFC , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesAnnualFees , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NewChargesLateFees , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.AmountOfPayments , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.AmountOfCredits , '000000000000000' )&#0124; &#0124;
    NVL(ccs.t_edw.NumberOfPurchases , '00000' )&#0124; &#0124;
    NVL(ccs.t_edw.NumberOfCashAdvances , '00000' )&#0124; &#0124;
    ccs.t_edw.TS1COMPANYNUMBER&#0124; &#0124;
    ccs.t_edw.COUNTRYCODE&#0124; &#0124;
    ' '&#0124; &#0124; -- MCIF Close code
    ccs.t_edw.FILENUMBER&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    '00000'&#0124; &#0124;
    ' '&#0124; &#0124;
    '000000000000000'&#0124; &#0124;
    '0000000'&#0124; &#0124;
    '00000'&#0124; &#0124;
    ' '&#0124; &#0124;
    '000000000000000'&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    ' '&#0124; &#0124;
    DECODE(ccs.t_account.prodind, 1, ' ', 'F')
    FROM
    ccs.t_edw,
    ccs.t_account
    WHERE ccs.t_edw.accountid = ccs.t_account.accountid
    AND ccs.t_account.dateopen = to_date(ccs.t_edw.DATEOPEN,'yyyyddd')
    AND ccs.t_account.dateopen < (add_months(dtDateProcess,1)-1);
    BEGIN
    SELECT max(processdate)
    INTO dtDateProcess
    FROM ccs.t_processlog
    WHERE filename = 'ACCTINFO';
    -- Create a log entry in the t_processlog
    INSERT INTO ccs.t_processlog
    (filename,processdate,completioncode)
    VALUES
    ('EDWEXTRACT',dtDateProcess,9);
    SELECT max(processid)
    INTO dPid
    FROM ccs.t_processlog
    WHERE filename = 'EDWEXTRACT'
    AND processdate = dtDateProcess;
    iRetValue := CCS.StartPID(dPid, 0, 0);
    ccs.populateedw92(1, dtDateProcess);
    IF (SQLCODE != 0) THEN
    iRetValue := CCS.UpdatePIDDesc(dPid, 1, 99, 'ccs.populateedw92 failed! See t_exception for error.',0);
    RAISE EDW92;
    END IF;
    ccs.populateedw54(2, dtDateProcess);
    IF (SQLCODE != 0) THEN
    iRetValue := CCS.UpdatePIDDesc(dPid, 1, 99, 'ccs.populateedw54 failed! See t_exception for error.',0);
    RAISE EDW54;
    END IF;
    OPEN edw_extract_cur;
    -- Caution: UTL_FILE.FOPEN using w option! Will overwrite existing file!
    outfile_handle := UTL_FILE.FOPEN(outfile_dir,outfile_name,'w',1437);
    IF (SQLCODE != 0) THEN
    iRetValue := CCS.UpdatePIDDesc(dPid, 1, 99, 'Problem creating data file! See t_exception for error.',0);
    RAISE FILE_OPEN_ERROR;
    END IF;
    LOOP
    FETCH edw_extract_cur INTO szdata_rec;
    EXIT WHEN edw_extract_cur%NOTFOUND;
    UTL_FILE.PUT_LINE(outfile_handle,szdata_rec);
    IF (SQLCODE != 0) THEN
    iRetValue := CCS.UpdatePIDDesc(dPid, 1, 99, 'Problem creating data file! See t_exception for error.',0);
    RAISE PUTLINE_ERROR;
    END IF;
    END LOOP;
    -- update t_processlog with status of 1 for dPid
    UTL_FILE.FCLOSE (outfile_handle);
    IF (SQLCODE != 0) THEN
    iRetValue := CCS.UpdatePIDDesc(dPid, 1, 99, 'Problem closing data file! See t_exception for error.',0);
    RAISE FILE_CLOSE_ERROR;
    END IF;
    -- Drop index on t_edw table
    icursor_name := sys.dbms_sql.open_cursor;
    sys.dbms_sql.parse(icursor_name,'DROP INDEX ccs.i_t_edw_accountid ', sys.dbms_sql.v7);
    irows_processed := sys.dbms_sql.execute(icursor_name);
    sys.dbms_sql.close_cursor(icursor_name);
    IF (sqlcode != 0) THEN
    RAISE DROP_INDEX_FLAG;
    ELSE
    COMMIT;
    END IF;
    -- Recreate index on t_edw table
    icursor_name := sys.dbms_sql.open_cursor;
    sys.dbms_sql.parse(icursor_name,'CREATE INDEX ccs.i_t_edw_accountid ON ccs.t_edw (accountid) tablespace tsindex storage (initial 30m next 30m pctincrease 0) parallel(degree 5) nologging', sys.dbms_sql.v7);
    irows_processed := sys.dbms_sql.execute(icursor_name);
    sys.dbms_sql.close_cursor(icursor_name);
    IF (sqlcode != 0) THEN
    RAISE CREATE_INDEX_FLAG;
    ELSE
    iRetValue := CCS.UpdatePIDDesc(dPid, 1, 1, 'EDWEXTRACT Completed successfully.',0);
    COMMIT;
    END IF;
    EXCEPTION WHEN EDW54 THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'The populateedw54 failed! Contact support personnel.');
    WHEN EDW92 THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'The populateedw92 failed! Contact support personnel.');
    WHEN DROP_INDEX_FLAG THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Failed to drop index on t_edw table! Contact support personnel.');
    WHEN CREATE_INDEX_FLAG THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Failed to create index on t_edw table! Contact support personnel.');
    WHEN NO_DATA_FOUND THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'No data found! Contact support personnel.');
    WHEN FILE_CLOSE_ERROR THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Unable to close data file! Contact support personnel.');
    WHEN PUTLINE_ERROR THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLE   rrText,'Failed to write szdata_rec to file! Contact support personnel.');
    WHEN FILE_OPEN_ERROR THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Failed to open data file! Contact support personnel.');
    WHEN UTL_FILE.INVALID_PATH THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Invalid path! Contact support personnel.');
    WHEN UTL_FILE.INVALID_MODE THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Invalid mode! Contact support personnel.');
    WHEN UTL_FILE.INVALID_FILEHANDLE THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Bad file handle! Contact support personnel.');
    WHEN UTL_FILE.INVALID_OPERATION THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Invalid operation! Contact support personnel.');
    WHEN UTL_FILE.WRITE_ERROR THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Unable to write to file, ERROR! Contact support personnel.');
    WHEN UTL_FILE.INTERNAL_ERROR THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'Utl_file internal error! Contact support personnel.');
    WHEN OTHERS THEN
    szSQLErrText := SUBSTR(SQLERRM,1,250);
    iRetValue := ccs.ExceptionWrite(dPid,szSQLErrText,'EDWEXTRACT failed due to unknown reason! Contact support personnel.');
    END;
    /I guess my confusion is how can I put a trigger on the t_processlog table to start a job when another finishes, and still have the job called make an entry into the t_processlog? I looked at the code for suggested work around, but I'm a little confused as to what is going on. Can anyone give me an idea for what to do in the situation? Thanks.
    Adam Bolduc
    null

    I didn't see your coding but i think you are selecting the same table through the procedure, on which you have written the db trigger.
    In that case it will alway gives you mutating error.
    Sanjeev

  • ORA-04091: table QA.LIB_ACCESSION_LOG is mutating

    hi
    while executing this:
    SQL> insert into LIB_ACCESSION_LOG select * from LIB_ACCESSION_LOG11;
    insert into LIB_ACCESSION_LOG select * from LIB_ACCESSION_LOG11
    ERROR at line 1:
    ORA-04091: table QA.LIB_ACCESSION_LOG is mutating, trigger/function may not
    see it
    ORA-06512: at "QA.TRG_ACCESSION_LOG", line 2
    ORA-04088: error during execution of trigger 'QA.TRG_ACCESSION_LOG'
    how can i do this insert and resolve this error. should i switch off the constraints? and what will happen when i switch on the constraints?

    ORA-04091, ORA-06512, ORA-04088.

  • ORA-04091 (table string.string is mutating) and Function-Based Index

    I've encountered a problem with DELETEing from a table when that table has a function-based index on it. The following demonstrates this:
    SQL> CREATE OR REPLACE FUNCTION get_employee_location(p_empno IN number)
      2  RETURN varchar2
      3  DETERMINISTIC
      4  IS
      5  l_return_value   varchar2(20);
      6  BEGIN
      7  SELECT loc
      8  INTO   l_return_value
      9  FROM   dept
    10  WHERE  deptno = (SELECT
    11                   e.deptno
    12                   FROM emp e
    13                   WHERE empno = p_empno);
    14  return l_return_value;
    15  end;
    16  /
    Function created.
    SQL> create index location_idx on emp (get_employee_location(empno));
    Index created.
    SQL> delete from emp;
    delete from emp
    ERROR at line 1:
    ORA-04091: table SCOTT.EMP is mutating, trigger/function may not see it
    ORA-06512: at "SCOTT.GET_EMPLOYEE_LOCATION", line 7------------------------------------------------
    The question is: How can I successfully DELETE FROM emp but keep my function-based index in place?
    Thanks
    Andy

    'Being able to' is 'being able to', but
    it is dangerous to declare "DETERMINISTIC" for non-deterministic function.
    The following problem happens on non-deterministic function index.
    SQL> update dept set loc = 'NEWYORK' where deptno=10;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from emp where get_employee_location(deptno)='NEWYORK';
    no rows selected
    SQL> select * from dept;
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEWYORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    SQL> select empno,ename from emp where get_employee_location(deptno)='NEW YORK';
         EMPNO ENAME
          7782 CLARK
          7839 KING
          7934 MILLER
    SQL> select empno,ename,get_employee_location(deptno) from emp where deptno=10;
         EMPNO ENAME      GET_EMPLOYEE_LOCATION(DEPTNO)
          7782 CLARK
          7839 KING
          7934 MILLER
    SQL> select empno,ename,get_employee_location(deptno) from emp where get_employee_location(deptno)='NEW YORK';
         EMPNO ENAME      GET_EMPLOYEE_LOCATION(DEPTNO)
          7782 CLARK      NEW YORK
          7839 KING       NEW YORK
          7934 MILLER     NEW YORK
    SQL> drop index location_idx ;
    Index dropped.
    SQL> select empno,ename from emp where get_employee_location(deptno)='NEW YORK';
    no rows selected

  • How To Get Around iCloud Terms

    How To Get Around iCloud Terms & Conditions Error After iOS 7 Upgrade
    It is being widely reported that some users are experiencing errors with iCloud after upgrading to iOS 7.  The issue has to do with the iCloud Terms & Conditions which were changed with the new version of iOS.  After upgrading, users are prompted to accept the new iCloud Terms & Conditions but when they attempt to do so they get a “Unable to connect to server” error.  This then disables iCloud on their device

    Hi nene
               in case of invoice without PO, The payment term will be selected from the vendor master data (in View : payment terms transaction in XK03).
    Check payment term in  master data is exist or not.
    the data is in the table LFB1 : Field ZTERM
    Regards
    Wiboon

  • Transaction Lock in Forms (TM,TX) How to get around?

    Hi,
    what is industry practice to avoid blocking locks bringing application processing to a standstill.
    I have few core table in material module e.g. material master, request, receipt, issues, whenever multiple user start using their respective forms such ac material_request, material_receipt, material_issue, Transaction Locks are acquired. and unless and until blocking user commits his transaction nobody else is able to work. how to get around this problem.
    There is lot of tech.material on net which tells me how to find blocking lock and objects, but nobody is giving answer how to avoid this situation.
    what is industry practice to avoid blocking locks bringing application processing to a standstill.
    regards

    Risky Solution !!
    I am facing more problem in to material requisition form, because many user want to request material. they open this form start entry and when they stuck for information they just keep that form open, in background the tables are locked because of change in data-block. now what do i do.
    regards

  • How to get the data from Pooled Table T157E.

    Hi Experts,
    How to get the data from Pooled Table T157E.
    Any help.
    Thanks in Advance,
    Ur's Harsha.

    create some internal table similar to T157E and pass all data as per SPRAS.
    After that use internal table in your program as per the requirement.
    Regds,
    Anil

  • HT1222 My phone is telling me about a Software Update but for the first time it is asking me for a passcode, I have never set up a passcode and do not know how to get around this to do the upgrade?

    My phone is telling me about a Software Update 7.1.1 but for the first time it is asking me for a passcode, I have never set up a passcode and do not know how to get around this to do the upgrade?

    See if this helps:
    iOS: Forgotten passcode or device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212

  • Since I upgraded to os 5.1 for my iPhone I can no longer type in reminders. Any suggestions how to get around having to use siri for reminders?

    since I upgraded to os 5.1 for my iPhone I can no longer type in reminders. Any suggestions how to get around having to use siri for reminders?

    Unfortunately, I have a very similar problem. Since I upgraded to os 5.1 on my new iPhone 4S the reminders screen will not add new reminders or scroll up and down. What's more strange is the screen will still scroll side to side allowing access to the Completed list, and both the Completed list and Date functions work normally so this must be an upgrades glitch.

  • I accepted/installed an update for iMovie and it turns out that this version is not compatible with my graphics card. So now I can no longer open or use iMovie.  Any ideas on how to get around this - how to revert to the previous version.

    I accepted/installed an update for iMovie and it turns out that this version is not compatible with my graphics card. So now I can no longer open or use iMovie.  Any ideas on how to get around this - how to revert to the previous version??

    Look in your Applications folder.  If your system behaved as expected, you should have an iMovie 9.0 folder in your Applications folder.  Apple moved the old version there as even they suspected the new versions was a train wreck.

  • Please help! We got a used Mac Mini and we don't have the former owner's password, so we can't install anything like flash player.  Does anyone know how to get around this?

    Please help! We got a used Mac Mini and we don't have the former owner's password, so we can't install anything like flash player.  Does anyone know how to get around this? I don't know how to wipe the hard drive, and the support online doesn't seem to work.

    As posted previously:
    Reinstall OS X without erasing the drive
    Do the following:
    1. Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    2. If the drive is OK then quit DU and return to the installer.  Proceed with reinstalling OS X.  Note that the Snow Leopard installer will not erase your drive or disturb your files.  After installing a fresh copy of OS X the installer will move your Home folder, third-party applications, support items, and network preferences into the newly installed system.
    If installing Leopard the process is similar in some respects.  If you wish to begin anew then after selecting the target disk click on the Options button and select the Erase and Install option then click on the OK button.  To install over an existing system do the following:
    How to Perform an Archive and Install
    An Archive and Install will NOT erase your hard drive, but you must have sufficient free space for a second OS X installation which could be from 3-9 GBs depending upon the version of OS X and selected installation options. The free space requirement is over and above normal free space requirements which should be at least 6-10 GBs. Read all the linked references carefully before proceeding.
    1. Be sure to use Disk Utility first to repair the disk before performing the Archive and Install.
    Repairing the Hard Drive and Permissions
    Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Installer menu (Utilities menu for Tiger, Leopard or Snow Leopard.) After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list. In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer. Now restart normally.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    2. Do not proceed with an Archive and Install if DU reports errors it cannot fix. In that case use Disk Warrior and/or TechTool Pro to repair the hard drive. If neither can repair the drive, then you will have to erase the drive and reinstall from scratch.
    3. Boot from your OS X Installer disc. After the installer loads select your language and click on the Continue button. When you reach the screen to select a destination drive click once on the destination drive then click on the Option button. Select the Archive and Install option. You have an option to preserve users and network preferences. Only select this option if you are sure you have no corrupted files in your user accounts. Otherwise leave this option unchecked. Click on the OK button and continue with the OS X Installation.
    4. Upon completion of the Archive and Install you will have a Previous System Folder in the root directory. You should retain the PSF until you are sure you do not need to manually transfer any items from the PSF to your newly installed system.
    5. After moving any items you want to keep from the PSF you should delete it. You can back it up if you prefer, but you must delete it from the hard drive.
    6. You can now download a Combo Updater directly from Apple's download site to update your new system to the desired version as well as install any security or other updates. You can also do this using Software Update.

Maybe you are looking for

  • MARDH table update

    Dear Experts, We have a Z report for Stock on posting date(similar to MB5B with some addons as per client reqmt) and we have used MARDH table for opening stock for any period in that report. But we face problems now as this table is not getting updat

  • How to disable generic alv buttons in CL_SALV_TABLE?

    I am needing to disable individually the generic alv buttons in CL_SALV_TABLE.  I see how to disable buttons by group.  eg-      lr_functions->set_group_export( abap_false ).      lr_functions->set_group_filter( abap_false ).      lr_functions->set_g

  • What the best way for STORAGE the documents from DMS?

    Please, can someone tell me if the limit of storage the originals through a data carrier is two for document or i can to large this limit? 'Cause i know that using Kpro i don't have limit of storage, but i'm trying to use the data carriers 'cause i j

  • Macbook and loss of power

    I lost power with my Macbook, and after rebooting, my email accounts were gone!!

  • Understunding this code for having two instanciation of applets

    this an exemple i would like to understund how this code work and how it make difference between register() and register(buffer, (short)(offset + 1), (byte)buffer[offset]); protected MyApplet1(byte[] buffer, short offset, byte length) {     // data o