HRMS Mutating Custom Trigger Error

Hi Gurus! In Oracle 10.7 SC HRMS, the column PERSON_TYPE_ID in table PER_ALL_PEOPLE_F was used to populate the actual person type. In releases 11+, this column was redesigned to hold just the default user_person_type for a given system_person_type. It is not maintained to reflect the true user person type. Only the table person_type_usages_f will give you the true user_person_type. (Note: column PERSON_TYPE_ID in table PER_ALL_PEOPLE_F is ONLY used by non-HR areas, such as Purchasing)
This link explains this:
http://www.aboutoracleapps.com/2008/07/difference-between-perallpeoplefpersont.html
My issue- our client upgraded from 10.7 to R12. The issue is that their custom code (a lot of it) looks at the column PERSON_TYPE_ID in table PER_ALL_PEOPLE_F to determine the actual person type.
Since my client doesnt use Purchasing (or any other modules), and they have LOTS of custom code that looks at the PERSON_TYPE_ID column, it was decided that we would just populate that column with the correct person type.
We created a trigger on the PER_PERSON_TYPE_USAGES_F table. Basically, any time a person type changes, the PERSON_TYPE_ID column is updated in the PER_ALL_PEOPLE_F table. Simple update.
The problem is, we get a mutating table error. Does anyone see why? Or how my logic is not sound? Thank you.
Trigger:
BEFORE INSERT OR UPDATE ON "APPS"."PER_PERSON_TYPE_USAGES_F" FOR EACH ROW
BEGIN
     UPDATE PER_ALL_PEOPLE_F
     SET PERSON_TYPE_ID = :new.person_type_id
     WHERE person_id = :NEW.person_id
     AND sysdate BETWEEN effective_start_date AND effective_end_date;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20005, 'Trigger UPDATE_PERSON_TYPE_ID: '||SQLERRM);
END;
Application Error:
ORA-20005: Trigger UPDATE_PERSON_TYPE_ID: ORA-04091: table HR.PER_PERSON_TYPE_USAGES_F is mutating, trigger/function may not see it
ORA-06512: at "APPS.PER_ALL_PEOPLE_F_ARIU", line 228
ORA-04088: error during execution of trigger 'APPS.PER_ALL_PEOPLE_F_ARIU'
ORA-04088: error during execution of trigger 'XXMIL.UPDATE_PERSON_TYPE_ID'
ORA-06512: at "APPS.PER_PTU_SHD", line 398
ORA-06512: at "APPS.PER_PTU_UPD", line 256
ORA-06512: at "APPS.PER_PTU_UPD", line 338
ORA-06512: at "APPS.PER_PTU_UPD", line 781
ORA-06512: at "APPS.PER_PTU_UPD", line 915
ORA-06512: at "APPS.HR_PER_TYPE_USAGE_INTERNAL", line 357
ORA-06512: at "APPS.HR_PER_TYPE_USAGE_INTERNAL", line 757
ORA-06512: at "APPS.HR_PER_PEOPLE12_PKG", line 1311

Jason,
you should push to change your custom code.
Direct update over seeded tables is not supported by Oracle.
per_people_f updates are allowed only through front end or API, and I doubt there is an API to update the person_Type_id.
Furthermore it's way a bloody road to have the trigger, maintain it over upgrades and patches, have it firing at the right time (order in which they fire is not predictable), have data the consistent if you eventually upgrade to iREc o Benefits (when the person type could become ex-Employee.Applicant....).
I believe triggers on per_people_f are not recommendable (except for auditing). You should create your custom function and substitute any person_type_id occurrence with your custom function (or use the hr_person_type_usage_info.get_user_person_type or another if suit you well).
If you are upgrading from 10.7 to 12i, a lot of rework should be envisaged, so there should be room to create a business case to stick to oracle standard and adjust your custom code. Indeed you should check wth Oracle if what proposed is actually supported by them, this would eventually make your recomendation accepted.
my 2c.
Giuseppe
Edited by: Giuseppe on 07-Jun-2012 10:27

Similar Messages

  • Mutating Trigger error while updating table

    Hi Guys,
    I am updating one table and after trigger also fire at the same time. Now, I want to avoid mutating trigger error. Can any one help me on this.
    Thanks in advance!
    Regards,
    -LRK

    You'll have to read these articles first, they explain what's the problem and how to deal with it:
    http://www.oracle-base.com/articles/9i/MutatingTableExceptions.php
    http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551198119097816936
    but, as Saubhik already said, using Oracle's AUDIT functionality would be the way to go.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4007.htm
    Using an autonomous transaction can result in corrupted data or unexpected errors, stay away from them if you want to use them in order to bypass/hide your mutating table error.

  • Custom Trigger and error handling problem

    hi ! I'm creating a custom trigger in ASP
    <br />
    <br />all it do is to check the lenght of given string.
    <br />it has a logic , true or false operation.
    <br />I just want to display an error message !
    <br />
    <br />I try BEFORE or AFTER in trigger register, but still didn't work !
    <br />
    <br />but why it didn't work ?
    <br />
    <br />any ideas ?
    <br />
    <br /><%<br />'start Trigger_Custom trigger<br />Function Trigger_Custom (ByRef tNG)<br /><br /> xemployer = len(trim(tNG.getColumnValue("employer")))<br /> xemail = len(trim(tNG.getColumnValue("email")))<br /> xjob_position = len(trim(tNG.getColumnValue("job_position")))<br /> xeducation = len(trim(tNG.getColumnValue("education")))<br /> xreference = len(trim(tNG.getColumnValue("reference")))<br /> xage_max = len(trim(tNG.getColumnValue("age_max")))<br /> xgender = len(trim(tNG.getColumnValue("gender")))<br /> <br /> totallen = (xemployer + xemail + xjob_position + xeducation + xreference + xage_max + xgender)<br /><br /> if (totallen > 158) then<br /><br /> Set update_error = new tNG_error<br /> update_error.init "Your Data contain too much characters ! (max 158)", Array(), Array()<br /> Set Trigger_Custom = update_error<br /><br />  else<br /> Set Trigger_Custom = nothing<br />  end if<br /><br />Set Trigger_Custom = nothing<br />End Function<br />'end Trigger_Custom trigger<br />%>
    <br /><%<br />' Register triggers<br />ins_Job.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1")<br />ins_Job.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation)<br />ins_Job.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.asp")<br />ins_Job.registerTrigger Array("BEFORE", "Trigger_Custom", 50)<br />%>
    <br />
    <br /><%<br />' Register triggers<br />upd_Job.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1")<br />upd_Job.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation)<br />upd_Job.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.asp")<br />upd_Job.registerTrigger Array("BEFORE", "Trigger_Custom", 50)<br />%>

    hello there, thanks for replying
    <br />i know what you mean, i see that the first time i submitted in to this forum.
    <br />
    <br />actually IT IS SEPARATED !
    <br />i just copy paste my code into this TextBOX, and that's whats happened
    <br />
    <br />ok i copy paste my code again, but this time i use ENTER to seperated those lines.
    <br />
    <br /><% 'start Trigger_Custom trigger <br /><br />Function Trigger_Custom (ByRef tNG) <br /><br />xemployer = len(trim(tNG.getColumnValue("employer"))) <br />xemail = len(trim(tNG.getColumnValue("email"))) <br />xjob_position = len(trim(tNG.getColumnValue("job_position"))) <br />xeducation = len(trim(tNG.getColumnValue("education"))) <br />xreference = len(trim(tNG.getColumnValue("reference"))) <br />xage_max = len(trim(tNG.getColumnValue("age_max"))) <br />xgender = len(trim(tNG.getColumnValue("gender"))) <br /><br />totallen = (xemployer + xemail + xjob_position + xeducation + xreference + xage_max + xgender) <br /><br />if (totallen > 158) then <br /><br />Set update_error = new tNG_error <br />update_error.init "Your Data contain too much characters ! (max 158)", Array(), Array() <br />Set Trigger_Custom = update_error <br /><br />else <br />Set Trigger_Custom = nothing <br />end if <br /><br />Set Trigger_Custom = nothing <br />End Function <br />'end Trigger_Custom trigger <br />%>
    <br />
    <br /><% ' Register triggers <br /><br />ins_Job.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1") ins_Job.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation) ins_Job.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.asp") ins_Job.registerTrigger Array("BEFORE", "Trigger_Custom", 50) <br /><br />%>
    <br />
    <br /><% ' Register triggers <br /><br />upd_Job.registerTrigger Array("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1") upd_Job.registerTrigger Array("BEFORE", "Trigger_Default_FormValidation", 10, formValidation) upd_Job.registerTrigger Array("END", "Trigger_Default_Redirect", 99, "../includes/nxt/back.asp") upd_Job.registerTrigger Array("BEFORE", "Trigger_Custom", 50) <br /><br />%>
    <br />
    <br />there it is My Actual Code looks like.
    <br />
    <br />again, thanks for replying

  • Can anyone help with a custom trigger?

    Hi - I know this is a tough one and appreciate anyone's help!
    I'm trying to create a custom trigger that confirms 2 fields belong to the same record. If they do, proceed with insert transaction.
    I have gone through the tutorial (from the old Interakt Discussion Board tutorial at http://www.interaktonline.com/Documentation/MXKollection/075000_tutorialdiscussionboard.h tm) on how to create a custom trigger that checks to see whether a duplicate message and subject exist in the table and if so, stop the insert. I have this working fine, using my own table and fields.
    Can anyone help me to change the script here to confirm that both fields belong to the same record? Here is what I have right now:
    $query = "SELECT * FROM dan_camptrans_login_familyid_confirmid WHERE family_id = ".KT_escapeForSql($tNG->getColumnValue("family_id"),$tNG->getColumnType("family_id"))." AND confirm_id = ".KT_escapeForSql($tNG->getColumnValue("familyconfirm_id"),$tNG->getColumnType("familycon firm_id"));
    $result = $tNG->connection->Execute($query);
    if(!$result) {
    $error = new tNG_error("Could not access database!",array(),array());
    return $error;
    } else {
    if($numberOfRecords = $result->recordCount()) {
    $uniqueFailed = new tNG_error("There is already a message with the same subject and content!",array(),array());
    return $uniqueFailed;
    } else {
    return NULL;
    Any help would be SUPER appreciated!
    Dan

    Thank you very much Shane for responding.
    Right now, if I fill out the form and enter any numbers in the family_id and familyconfirm_id fields that are currently NOT in the dan_camptrans_login_familyid_confirmid table, the form submits fine. If however, both fields already exist within the same record, the error is returned.
    I guess what I am looking for is the opposite. When the form is submitted, the table dan_camptrans_login_familyid_confirmid is checked. If both field entries are not within the same record, return the error.
    Basically, I am sending out a user ID and confirmation number via mail to users. When they register they need to enter in both of these numbers and only if they match the records will the registration proceed.
    The main recordset/form that this custom trigger is attached to is one for my user registration table. This custom trigger and associated table is only to confirm the user registering has the correct information to register.
    Thanks again - I hope that I am explaining this clearly.
    Dan

  • Delete mutiple image with custom trigger

    I am attempting to delete multiple images associated with a record being deleted. The record has a field with the default filename, then each image has a prefix ("thumb_", "callout_", "feature_") along with this filename.
    My issue is two-fold. I am attempting this with a custom trigger (on the delete record; using AFTER), but I keep getting an error message when I try to pull in the filename using tNG->getColumnValue(). The error reads:
    tNG_fields.getColumnValue:
    Column file is not part of the current transaction.
    Here is my code:
    $file = $tNG->getColumnValue('file');
    deleteFileAndThumbs($file);
    My second issue is in regards to the redirect after the triggers.
    getPrimaryKeyValue() works just fine. Thus, if I change the image names to correspond to my record's "id" #, it will pull the ID # just fine. It will make it through my code and redirect back to the listing page. However, the images will not be deleted. If I remove the redirect, the images delete, but it just sits on this page. So I assume my issue is a result of the page redirecting before al the images are deleted. Is there a way to not allow the redirect to run until my deleteImages function is completed?
    Thanks!

    Ok. How about executing a SELECT inside a Custom Trigger and accessing
    the resulting rows to use in PHP code also in the trigger?
    Example - within the Custom Trigger execute:
    $sql="SELECT * FROM table";
    How do I execute it? With the regular DW code like:
    mysql_select_db($database_conWV, $conWV);
    $sql="SELECT * FROM table";
    $result = mysql_query($sql, $conWV) or die(mysql_error());
    $row_result = mysql_fetch_assoc($result);
    $totalRows_result = mysql_num_rows($result);
    or with some ADDT code like:
    $result = $tNG->connection->execute($sql);
    If I do the "ADDT" way, how do I access the rows?
    $result['column'] or something?
    Alec
    Adobe Community Expert

  • Mutating DB Trigger Problem

    Hello all, i have a ' Mutating DB Trigger Problem' for the following Trigger :
    =============================================
    CREATE OR REPLACE TRIGGER ASSIUT.EMP_ATTENDANCEE_MONA
    AFTER INSERT
    ON ASSIUT.ACCESSLOG
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    V_COUNT CHAR(2);
    --V_COUNT_OUT CHAR(2);
    BEGIN
    IF :NEW.INOUT = 'IN' THEN
        INSERT INTO EMP_ATTENDANCEE (EMP_ID, DATE_IN ,DATE_OUT ,TIME_IN ,TIME_OUT)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
                 NULL,
                 TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),      -- TIME_IN
                 NULL );      -- TIME_OUT
                     SELECT COUNT(employeeid )
                     INTO V_COUNT
                    FROM ACCESSLOG
                    WHERE employeeid =:NEW.employeeid
                    AND LOGDATE =:NEW.LOGDATE
                    AND  LOGTIME  =:NEW.LOGTIME
                    AND INOUT ='IN';
                    IF V_COUNT > 0 THEN
         INSERT INTO ATT_INCOMPLETE  (  EMP_ID , ATT_DATE , ATT_TIME ,  ATT_FLAG)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
          TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),        -- TIME_IN
          1); -- check in
          END IF;
    ELSIF :NEW.INOUT = 'OUT' THEN
        UPDATE  EMP_ATTENDANCEE
        SET           DATE_OUT   =  TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'), -- DATE_OUT,
                      TIME_OUT   =   TO_DATE(:NEW.LOGTIME,'HH24:MI:SS') -- TIME_OUT
        WHERE   EMP_ID           =   TO_NUMBER(TO_CHAR(:NEW.employeeid,99999))
        AND DATE_IN =  (SELECT MAX (DATE_IN )
                        FROM EMP_ATTENDANCEE
                        WHERE EMP_ID = EMP_ID
                        AND   DATE_OUT IS NULL
                        AND   TIME_OUT IS NULL ) ;
                  SELECT COUNT(employeeid )
                     INTO V_COUNT
                    FROM ACCESSLOG
                    WHERE employeeid =:NEW.employeeid
                    AND LOGDATE =:NEW.LOGDATE
                    AND  LOGTIME  =:NEW.LOGTIME
                    AND INOUT ='OUT';
                    IF V_COUNT > 0 THEN
    INSERT INTO ATT_INCOMPLETE  (  EMP_ID , ATT_DATE , ATT_TIME ,  ATT_FLAG)
         VALUES (TO_NUMBER(TO_CHAR(:NEW.employeeid,99999)),
                 TO_DATE(:NEW.LOGDATE,'dd/mm/rrrr'),       -- DATE_IN
          TO_DATE(:NEW.LOGTIME,'HH24:MI:SS'),        -- TIME_IN
         0); -- check in
    END IF;
    END IF;
      EXCEPTION
       WHEN OTHERS  THEN RAISE;
    END EMP_ATTENDANCEE_MONA ;The above Trigger generates the following error:
    ORA-04091: table ASSIUT.ACCESSLOG is mutating, trigger/function may not see it
    ORA-06512: at "ASSIUT.EMP_ATTENDANCEE_MONA'", line 65
    ORA-04088: error during execution of trigger 'ASSIUT.EMP_ATTENDANCEE_MONA'i want an easy and a straight forward solution to this problem which occured on selecting or manipulating from the same table i triggered it.
    Best regards,
    Abdetu..

    Create a package
    CREATE OR REPLACE PACKAGE PK_TRIGGER IS
      PROCEDURE PR_BS;
      PROCEDURE PR_ARIU(i_vcType IN TABLE.COLUM%TYPE, i_nEmpId TABLE.COLUM%TYPE, i_vcLogDate IN TABLE.COLUMN%TYPE, i_vcLogTime IN TABLE.COLUMN%TYPE);
      PROCEDURE PR_AS;
    END;
    CREATE OR REPLACE PACKAGE BODY IS
      TYPE tData IS RECORD (
        vcType     TABLE.COLUMN%TYPE,
        nEmpid     TABLE.COLUMN%TYPE,
        vcLogDate TABLE.COLUMN%TYPE,
        vcLogTime TABLE.COLUMN%TYPE
      TYPE tDataList IS TABLE OF tData INDEX BY BINARY_INTEGER;
      lData tData;
      PROCEDURE PR_BS IS
      BEGIN
        lData.DELETE;
      END;
      PROCEDURE PR_ARIU(i_vcType IN TABLE.COLUM%TYPE, i_nEmpId TABLE.COLUM%TYPE, i_vcLogDate IN TABLE.COLUMN%TYPE, i_vcLogTime IN TABLE.COLUMN%TYPE) IS
        iPos PLS_INTEGER:=lData.COUNT+1;
      BEGIN
        lData(iPos).vcType:=i_vcType;
        lData(iPos).nEmpId:=i_nEmpId;
        lData(iPos).vcLogDate:=i_vcLogDate;
        lData(iPos).vcLogTime:=i_vcLogTime;
      END;
      PROCEDURE PR_AS IS
        CURSOR crCheck(i_nIdentnum IN NUMBER) IS
          SELECT 1
            FROM <YOURTABLE> A,
                 <YOURTABLE> B
           WHERE A.IDEN_NUM=B.IDENT_NUM
             AND (   A.BEGIN_DATE BETWEEN B.BEGIN_DATE AND B.END_DATE
                  OR A.END_DATE BETWEEN B.BEGIN_DATE AND B.END_DATE
        iPos PLS_INTEGER;
        nDummy NUMBER;
      BEGIN
        iPos:=lData.FIRST;
        LOOP
          EXIT WHEN iPos IS NULL;
          -- Do whatever you want with the data in the record
          -- Process next record
          iPos:=lIds.NEXT(iPos);
        END LOOP;
        lIds.DELETE;
      END;
    END;replace TABLE.COLUM%TYPE with appropiate table and column
    Now create a
    - Before Statement trigger on your table calling PK_TRIGGER.PR_BS;
    - After Insert on Update for each row Trigger calling PK_TRIGGER.PR_ARIU(...values...);
    - After Statement trigger on your table calling PK_TRIGGER.PR_AS;
    Hope the code compiles for i have no database at hand.
    Andreas

  • Custom Trigger issues on PO_DISTRIBUTIONS_ALL table... null id?

    Hi...I have a custom after insert trigger on the PO_DISTRIBUTIONS_ALL table
    It is having an issue with getting the req_distribution_id
    I took out all the code and left in just a test, which only inserts the id into a test table. But it is always null! Can someone tell me why? Because there is an ID when created, and I see it after I query the table when it is finished. But I figured, after insert it will be there!
    Below is the trigger...
    create or replace
    TRIGGER APPS.xxmc_po_distributions_auir
    AFTER INSERT OR UPDATE ON PO_DISTRIBUTIONS_ALL
    REFERENCING NEW AS new OLD AS old
    FOR EACH ROW
    DECLARE
    v_trigger_location VARCHAR2(2000):= 'Declaration';
    v_error_message VARCHAR2(2000);
    BEGIN
    delete from test_table;
    insert into test_table values(to_char(:new.req_distribution_id));
    END;
    This enters null every time into the table. Why is that?
    -J

    OK my new trigger has the dml statements in a procedure and it still fails. The ID is always null. Below is the trigger...why is the id coming up null???
    :new.req_distribution_id should never be a null value in my opinion, right?
    create or replace
    TRIGGER APPS.xxmc_po_distributions_auir
    AFTER INSERT OR UPDATE ON PO_DISTRIBUTIONS_ALL
    REFERENCING NEW AS new OLD AS old
    FOR EACH ROW
    DECLARE
    v_trigger_location VARCHAR2(2000):= 'Declaration';
    v_error_message VARCHAR2(2000);
    /* Error Tracking local variables */
    v_user_id NUMBER := FND_GLOBAL.User_Id;
    v_inv_record_id_s NUMBER := 0;
    v_mycall_status VARCHAR2(20);
    v_myerror_msg VARCHAR2(200);
    v_ric_code VARCHAR2(10);
    v_tracking_id VARCHAR2(200);
    v_source_system xxmc_track_summary.source_system%TYPE := 'XXMC_CRM';
    v_destination_system xxmc_track_summary.destination_system%TYPE := 'XXMC_CRM';
    v_rice_name xxmc_track_summary.rice_object_name%TYPE := 'E120';
    v_failure_record_count xxmc_err_track_det.error_count%TYPE := 0;
    v_module_name xxmc_err_track_det.procedure_name%TYPE := 'XXMC_PO_DISTRIBUTIONS_AUIR';
    v_stg_tablename xxmc_track_summary.staging_table_name%TYPE := '';
    v_processed INTEGER := 0;
    v_failed INTEGER := 0;
    v_total INTEGER := 0;
    v_commit INTEGER := 0;
    e_error_tracking_exception EXCEPTION;
    CURSOR c_get_req_line_info(p_req_distribution_id IN NUMBER) IS
    SELECT PORH.SEGMENT1
    , porh.attribute1 po_heading_att1
    , porl.line_num
    , porl.destination_context
    , porl.attribute1
    , porl.attribute3
    , porl.attribute4
    , porl.attribute5
    , porl.attribute6
    , porl.attribute7
    , porl.attribute8
    , porl.attribute9
    , porl.attribute10
    , porl.attribute11
    , porl.attribute12
    , porl.requisition_line_ID
    , to_char(porl.creation_date, 'mm/dd/yyyy hh24:mi:ss') format_create_date_line
    FROM PO_REQ_DISTRIBUTIONS_ALL PORD
    , PO_REQUISITION_LINES_ALL PORL
    , PO_REQUISITION_HEADERS_ALL PORH
    WHERE PORD.DISTRIBUTION_ID = p_REQ_DISTRIBUTION_ID
    AND PORL.REQUISITION_LINE_ID = PORD.REQUISITION_LINE_ID
    AND PORH.REQUISITION_HEADER_ID = PORL.REQUISITION_HEADER_ID
    i number := 0;
    TEMP NUMBER;
    BEGIN
    v_trigger_location := 'Beginning of trigger body';
    KMG_WRITE('INSERTING IN XXMC TRIGGER ON PO DISTRIBUTIONS AT '
    || TO_CHAR(SYSDATE, 'MM/DD/YYYY HH24:MI:SS')
    || ' REQ_DISTRIBUTION_ID = '
    || NVL(TO_CHAR(:new.req_distribution_id), 'VALUE IS NULL') );
    xxmc_tracking_pkg.create_source_tracking_record(
    p_tracking_id => v_tracking_id
    ,p_source_system => 'XXMC_CRM'
    ,p_destination_system => 'XXMC_CRM'
    ,p_rice_object_name => v_rice_name
    ,p_creation_date => sysdate
    ,p_created_by => v_user_id
    ,p_transaction_type => 'XXMC_CRM'
    ,p_status => 'INFLIGHT'
    ,p_if_direction => 'O'
    ,p_sub_status => 'XXMC_PROCESSING_IN_EBS'
    ,p_src_total_records => 0
    ,p_call_status => v_mycall_status
    ,p_error_msg => v_myerror_msg);
    IF v_mycall_status <> 'S' THEN
    RAISE e_error_tracking_exception;
    END IF;
    TEMP:='AAA';
    i := 0;
    FOR r IN c_get_req_line_info(:new.req_distribution_id) LOOP
    i := i + 1;
    UPDATE po_lines_all pol
    SET attribute_category = r.destination_context
    , Attribute1 = r.attribute1
    , Attribute3 = r.attribute3
    , Attribute4 = r.attribute4
    , Attribute5 = r.attribute5
    , Attribute6 = r.attribute6
    , Attribute7 = r.attribute7
    , Attribute8 = r.attribute8
    , Attribute9 = r.attribute9
    , Attribute10 = r.attribute10
    , Attribute11 = r.attribute11
    , Attribute12 = r.attribute12
    WHERE pol.po_line_id = :new.po_line_id;
    UPDATE po_headers_all poh
    SET attribute1 = r.po_heading_att1
    WHERE poh.po_header_id = :new.po_header_id;
    END LOOP;
    EXCEPTION
    WHEN e_error_tracking_exception THEN
    kmg_write('Could not create source tracking record in XXMC PO DISTRIBUTIONS trigger. Status = '
    || v_mycall_status || ' Msg = ' || v_myerror_msg);
    RAISE_APPLICATION_ERROR (
    num=> -20003,
    msg=> 'XXMC PO DISTRIBUTIONS trigger error in '
    || ' create_source_tracking_record '
    || v_myerror_msg);
    WHEN OTHERS THEN
    v_error_message := SQLERRM;
    kmg_write('Error in XXMC PO DISTRIBUTIONS trigger. ' || v_error_message);
    xxmc_tracking_pkg.log_then_report_errors(
    p_tracking_id => v_tracking_id
    ,p_source_system => v_source_system
    ,p_destination_system => v_destination_system
    ,p_det_record_id => v_inv_record_id_s
    ,p_message_name => 'XXMC_PO_DISTRIBUTIONS'
    ,p_message_description => 'XXMC_PO_DISTRIBUTIONS'
    ,p_message_text => ltrim(rtrim(v_error_message))
    ,p_last_update_date => sysdate
    ,p_procedure_name => v_module_name
    ,p_staging_table_name => v_stg_tablename
    ,p_status => 'FAILED'
    ,p_sub_status => 'XXMC_PROCESSING_IN_EBS'
    ,p_src_success_records => v_processed
    ,p_src_failed_records => v_failed
    ,p_dest_success_records => v_processed
    ,p_dest_failed_records => v_failed
    ,p_error_count => v_failed
    ,p_call_status => v_mycall_status
    ,p_error_msg => v_myerror_msg
    ,p_key_field_value => v_tracking_id);
    RAISE_APPLICATION_ERROR (
    num=> -20001,
    msg=> 'Error encountered in XXMC PO DISTRIBUTIONS AUIR Trigger '
    || ' Date = ' || to_char(sysdate, 'mm/dd/yyyy hh24:mi:ss')
    || ' SQLERRM = ' || v_error_message);
    END;

  • Custom trigger

    Hi--
    I am inserting into 2 tables sc_tblBioInfo and sc_tblSemesterInfo. I have 2 fields 'Plantoenroll' and 'year' that are inserted into 2 different fields into sc_tblSemesterInfo. That works fine.
    I also need to insert 'Plantoenroll' and 'year' combined into 1 field called 'Plantoenroll' in sc_tblBioInfo.
    I have created a custom trigger to combine them and insert into sc_tblBioInfo:
    function Trigger_Custom(&$tNG) {
    $Plantoenroll = $tNG->getColumnValue("Plantoenroll");
    $year = $tNG->getColumnValue("year");
    $newSubject = $Plantoenroll . $year;
    $ins_sc_tblBioInfo->addColumn("Plantoenroll","STRING_TYPE","VALUE",$newSubject);
    return null;
    I am getting an error "Column Plantoenroll is not part of the current transaction." How do I make Column Plantoenroll part of the current transaction?
    Is there a better way to insert 2 fields into a table and also insert those 2 fields as 1 field into a different table?
    Thanks for any help.
    --rayne

    Rayne,
    If I understand correctly, you want to insert/update a different table than the table the ADDT form is inserting to.
    The form on your page inserts a new record into sc_tblSemesterInfo table. You also want to insert a new value based on combining two fields into one and insert or update the new value in the sc_tblBioInfo table.
    Unfortunately, you cannot use:
    $ins_sc_tblBioInfo->addColumn("Plantoenroll","STRING_TYPE","VALUE",$newSubject);
    to update a different database table than the one the form is associated with.
    The correct code would be:
    $tNG->addColumn("Plantoenroll","STRING_TYPE","VALUE",$newSubject);
    but using this in a trigger only allows you to add Columns to the trasaction database table that the form is inserting to. You cannot tell it to update a different database table like this.
    The key question is whether you need to do an Update to an existing record in sc_tblBioInfo, or are you a doing fresh an insert in the sc_tblBioInfo table?
    You need to do a custom trigger that does a database call to do an insert or update operation on the sc_tblBioInfotable table. After you combine the values into a new value, are you needing to insert a new record into the sc_tblBioInfotable table, or are you needing to update an existing record in the sc_tblBioInfotable table?
    Shane

  • Custom Trigger Issues

    I am trying to create a PM messaging system with ADDT. So far, things are going pretty well. But I have a problem with a custom trigger i am trying to write. Before a message is sent, I want the recipients private message count to be checked. If it equals 2, an error message is displayed and the message does not get sent. This is the code that I have at the moment.
    //start checkPM_Count trigger
    function checkPM_Count(&$tNG) {
    $username_pmcount = $_POST['msg_reciever'];
    $checkPMCount_SQL = "SELECT u_pmcount from members WHERE u_name='$username_pmcount'";
    $result1 = mysql_query($checkPMCount_SQL) or die($checkPMCount_SQL."
    ".mysql_error());
    $pm_count = $result1['u_pmcount'];
    if ($pm_count == '2') {
    $tNG->setError(new tNG_error('The user you are trying to send a message to has 2 private messages, sorry but we cant send your message until that user deletes some of their messages.', array(), array()));
    Can anyone tell me if there is something wrong with the code above. No error message is shown and the message is still being sent regardless.
    Thanks

    I am trying to create a PM messaging system with ADDT. So far, things are going pretty well. But I have a problem with a custom trigger i am trying to write. Before a message is sent, I want the recipients private message count to be checked. If it equals 2, an error message is displayed and the message does not get sent. This is the code that I have at the moment.
    //start checkPM_Count trigger
    function checkPM_Count(&$tNG) {
    $username_pmcount = $_POST['msg_reciever'];
    $checkPMCount_SQL = "SELECT u_pmcount from members WHERE u_name='$username_pmcount'";
    $result1 = mysql_query($checkPMCount_SQL) or die($checkPMCount_SQL."
    ".mysql_error());
    $pm_count = $result1['u_pmcount'];
    if ($pm_count == '2') {
    $tNG->setError(new tNG_error('The user you are trying to send a message to has 2 private messages, sorry but we cant send your message until that user deletes some of their messages.', array(), array()));
    Can anyone tell me if there is something wrong with the code above. No error message is shown and the message is still being sent regardless.
    Thanks

  • Custom Trigger After Insert

    After a insert into table 1, i want to take a value from that transaction and use it in a custom trigger to instert into another datbase the 2 values. One is the primary key value of the transaction of table 1 and the other is a session variable of the logged in user. I can get the value of the session user, but i cant get the value of the transaction field.
    $updateRequestDate = "INSERT INTO request_notify (id_request, username) Values({rsrequest.id_request}, '" . $_SESSION['kt_login_user'] . "')";
    $update_result = $tNG->connection->execute($updateRequestDate);
    if(!$update_result) {
    $updateError = new tNG_error("Error setting the logged in status to N", array(), array());
    return $updateError;
    } else {
    return NULL;
    I have the custom trigger set to go after insert transaction.
    How do you get the value of a transaction field for a custom trigger?

    Gunter,
    You rock. Working example, using your knowledge.
    $updateRequestDate = "INSERT INTO test2 (idtest_note, username_note) VALUES ('". $tNG->getColumnValue("id_test") ."', '". $_SESSION['kt_login_user']."')";
    $update_result = $tNG->connection->execute($updateRequestDate);
    if(!$update_result) {
    $updateError = new tNG_error("Error setting the logged in status to N", array(), array());
    return $updateError;
    } else {
    return NULL;

  • Custom Trigger Connection

    Hello All.
    How do I change the connection in a Custom Trigger?
    I want to update a table in a second database.
    Jan

    Jan,
    I'm pretty sure you can do this. You should be able to do something like this in the trigger:
    mysql_select_db($database_Connection_2, $Connection_2);
    $query_RecordsetUpdate = "UPDATE....";
    $RecordsetUpdate = mysql_query($query_RecordsetUpdate, $Connection_2) or die(mysql_error());
    This is just the basic code with no error handling, which you may want to add.
    $database_Connection_2 and $Connection_2 need to match the variable names located in your database connection file for Connection_2 located in the Connections folder of your site.
    I have never had to connect to a separate database, but this should work.
    Be sure to add this at the top:
    require_once('Connections/Connection_2.php');
    So that your php script has access to the information for Connection_2.
    Shane

  • Custom Trigger Help

    Can i make a custom trigger that searches for all " " and replaces them with a zero (0). I have the update form feeding in to a form that will show errors if there is a zero in it, because it is using math.
    I have about 40 fields in a form and it can't have any blanks in it.
    Thanks in advance.
    Amy

    Ah I think I understand,
    <br />
    <br />---------
    <br /><% 'start Trigger_Custom trigger Function Trigger_Custom (ByRef tNG)<br /><br />Set Trigger_Custom = nothing<br />End Function<br />'end Trigger_Custom trigger<br />%>
    <br />---------
    <br />
    <br />sorry for still struggling a little, but as I´m a PHP guy, this code doesn´t say much to me - however this:
    <br />
    <br />$tNG-&gt;setColumnValue("column_name", your string replacement code here, $tNG-&gt;getColumnValue("column_name")));
    <br />
    <br />...would have to be copied and pasted into the "enter custom trigger code" text field of ADDT´s "Custom Trigger" behaviour, and then assumingly modified by replacing my "your string replacement code" dummy placeholder with your ASP code which would do that string replacement.
    <br />
    <br />Does this answer your question ?
    <br />
    <br />-------
    <br />As far as do you ever stop working, I mean you seem to be online all the time. Do you ever get a break?
    <br />-------
    <br />
    <br />Usually I´d take a nap now, because it´s 1:35 AM here in Germany -- but I´m a late riser anyway and still have some work to do, so I don´t care ;-)
    <br />
    <br />Cheers
    <br />Günter Schenk
    <br />Adobe Community Expert, Dreamweaver

  • Custom 404 Error page in Sharepoint Foundation 2013

    Hi all,
    How to point to the custom 404 error page in Share Point Foundation 2013. I have seen some links but not working for me. Please me let me know if you have any suggestion.
    Thanks.

    Can i create any page and pass the page url in it,like if i have created a page as custom404.aspx under pages library so do i need to do like this?
    $spsite = Get-SPSite "<http://sharepoint:1000/>"
    $spsite.FileNotFoundUrl = "<pages/custom404.aspx>"
    is this the correct way or i am doing incorrectly??
    please suggest

  • Session variable not storing in custom trigger

    I have a custom trigger in which I want to store a session variable , so i can use the value in the insert transaction which happens after. But for some reason the session variable is not stored, resulting in the data not being stored.
    any clues would help.
    rudi
    here are the relevant code:
    //start Trigger_Custom_Subject_Mentor trigger
    function Trigger_Custom_Subject_Mentor(&$tNG) {
    //Check subject exists
    @session_start();
    $_SESSION['sb_id'] = $subject_id;
    //end Trigger_Custom_Subject_Mentor trigger
    // Make an insert transaction instance
    $ins_share = new tNG_insert($conn_smart);
    $tNGs->addTransaction($ins_share);
    // Register triggers
    $ins_share->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_share->registerTrigger("END", "Trigger_Redirect", 90);
    // Add columns
    $ins_share->setTable("`share`");
    $ins_share->addColumn("share_item", "NUMERIC_TYPE", "POST", "share_item");
    $ins_share->addColumn("share_subject", "NUMERIC_TYPE", "SESSION", "sb_id");
    $ins_share->setPrimaryKey("share_id", "NUMERIC_TYPE");
    // Register triggers
    $ins_share->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");
    $ins_share->registerTrigger("BEFORE", "Trigger_Custom_Subject_Mentor", 50);
    $ins_share->registerTrigger("END", "Trigger_Default_Redirect", 99, "share.php?item_id={share_item}");

    hi User,
    1) Pull a dummy column in Fx use the Session variable --->(Variable -->session )
    2) Next, goto narrative view in Narrative view section use @1
    3) If u want you can hide the column that we created in criteria section

  • How can I set up a custom 404 error page on OSX Server?

    I moved my web site to a local server and changed the structure drastically.  Unfortunately I am getting hits for information that was on the old server which I haven't put back yet.  I'd like to set up a custom 404 Error Page to let people know what's up.  In server.app I can set up a 500 error page but not a 404 and when I tried hand coding it into the sites .conf file I really messed things up.  It took me a while to get that all corrected!
    Thanks for any advice,
    Bill W

    Found it!
    Under the web server Advanced Setting set "Allow overrides using .htaccess" then create an .htaccess file in the root directory with the line:
    ErrorDocument 404 notfounderror.html
    Use whatever HTML/PHP/etc. document you have created.

Maybe you are looking for

  • Can i put my itunes library on an external disk?

    hi, i want to store my itunes library on and external disk but want it to work just like it does on the internal hdd. is that possible? i tried to store it on a home server. and while i could play the contents of the library. the art-work and so-fort

  • About the MDF and log_LDF file in the SQL server

    Hai Experts , I need known the , What is MDF and log_ldf file . In our BPC server there are MDF and Log_LDF file in the MSSQLSERVER folder under the E drive. The both file have huge database size . Can u explain what is MDF and Log_LDF file , why its

  • Maximun size for  a datafile

    Hi, Oracle Version :10.2.0.1 Operating system:Linux Can any please tell me what is the maximum size that a datafile can grow and the maximum size for tablespace. Here i am having one tablespace which is having 4 datafile in that 2 datafile are 33 gb

  • Making sure photos are the exact same size

    I am creating before and after photos and need to make sure that each are the same size.  I will have groups of 2 side by side and then groups of 6 with 2 across and 3 down.  Once I create them in layers, is there a way that I can check to make sure

  • Convert 1D array a combobox

    I wondered if it's possible to convert a 1D array of VISA Resource Names (COM Ports) and convert them to Strings then input these into a combobox? I'm hung up on the first part. Solved! Go to Solution. Attachments: Image1.png ‏5 KB