Trigger issue

I have a trigger sitting on a table column and supposed to be fired after inserting or updating for each row. If I insert or update the table record by record, the trigger works fine. If I issue a batch inserting, sometimes the trigger does not work properly. e.g. I insert 4 records in that table, I should see 4 records in another table, but sometimes, I just see 2 or 3 of the records in another table, the trigger was stopped by some reason. This scenario is not always appear, just some times.
Do you have any idea what is behind the scene?
Thanks in advance.

Not insert the same record in another table. The code is a little bit long
Thanks
CREATE OR REPLACE TRIGGER int_01
AFTER INSERT OR UPDATE
ON history
FOR EACH ROW
WHEN (NEW.code = 0)
DECLARE
p_header_id               NUMBER;
p_sequence_no          NUMBER;
p_startdate               DATE;
p_ownerid               NUMBER;
p_employee_no          VARCHAR2(8);
p_work_date               DATE;
p_project_no          VARCHAR2(8);
     p_task_no               PLS_INTEGER;
p_service_code          VARCHAR2(5);
p_premium_code          VARCHAR2(5);
p_premium_cost          FLOAT (13);
p_submitted_by          VARCHAR2(8);
p_submitted_time     DATE;
p_approved_by          VARCHAR2(8);
p_approver_id          NUMBER;
p_hours_worked          NUMBER(5,2);
p_time_id               NUMBER;
v_cur_code VARCHAR2(1000);
v_cur_code2               VARCHAR2(1000);
v_cur_code3               VARCHAR2(1000);
TYPE ref_cursor IS REF CURSOR;
v_cur_01 ref_cursor;
v_cur_02 ref_cursor;
v_cur_03 ref_cursor;
     p_parent_task_code tasks.externalid%TYPE;
v_log VARCHAR2(2048);
     v_flag PLS_INTEGER DEFAULT 0;
     v_outlinelevel tasks.outlinelevel%TYPE;
     v_l2_task_code tasks.externalid%TYPE;
BEGIN
     BEGIN
SELECT int_header_id.NEXTVAL INTO p_header_id FROM dual;
INSERT INTO int_header_t01(ID,interface_table,status,TIMESTAMP,SOURCE) VALUES(p_header_id,'INT_EXP_TIME_trigger','W',SYSDATE,'eTime');
EXCEPTION
WHEN OTHERS THEN
     p_header_id := -1;
     v_log := v_log || ' Error Occurred when generating new header record. ' ||TRIM(SUBSTR(SQLERRM, 1, 255));
END;
     IF (p_header_id > 0) THEN                
     p_StartDate := :NEW.startdate;
     p_OwnerId := :NEW.personid;
     p_Approver_Id := :NEW.managerid;
     BEGIN
     SELECT SUBSTR(EmployeeNo,1,8) INTO p_Approved_By FROM person WHERE PersonId = p_Approver_Id;
     EXCEPTION
     WHEN OTHERS THEN
          v_flag := v_flag + 1;
          p_approved_by := NULL;
          v_log := v_log || ' Error Occurred when getting Approver''s Info. Approver_Id('||TRIM(TO_CHAR(p_approver_id,'999999999999999'))||'-'||TRIM(SUBSTR(SQLERRM,1,255));
     END;
     BEGIN
          SELECT TO_DATE(MAX(TO_CHAR(audit_date,'YYYY-MM-DD')||' '||TRIM(audit_time)),'YYYY-MM-DD HH24:MI:SS') INTO p_submitted_time FROM approval_audits
          WHERE StartDate = p_StartDate AND PersonId = p_OwnerId AND ApprovalCode = 'Submitted' ;          
          SELECT SUBSTR(employeeno,1,8) INTO p_submitted_by FROM approval_audits aa JOIN person
          ON ( aa.personname_id = person.personid AND TO_DATE(TO_CHAR(audit_date,'YYYY-MM-DD')||' '||TRIM(audit_time),'YYYY-MM-DD HH24:MI:SS') = p_submitted_time
          AND startdate = p_startdate AND aa.personid = p_ownerid AND approvalcode = 'Submitted' );
     EXCEPTION
          WHEN OTHERS THEN
          v_flag := v_flag + 1;
          p_submitted_by := NULL;
          v_log := v_log || ' Error Occurred when getting submitter''s Info. Owner_Id('||TRIM(TO_CHAR(:NEW.personid,'999999999999999'))||')-'||TRIM(SUBSTR(SQLERRM,1,255));
     END;
     IF (p_approved_by IS NOT NULL AND p_submitted_by IS NOT NULL) THEN          -- ******
v_cur_code := 'Select TimeId, SUBSTR(EmployeeNo,1,8), PostedDate, SUBSTR(ProjectCode,1,8), taskid
FROM times WHERE OwnerId = :p_OwnerId AND StartDate = :p_StartDate ';
OPEN v_cur_01 FOR v_cur_code USING p_OwnerId, p_StartDate ;
LOOP
          v_log := NULL;
FETCH v_cur_01 INTO p_Time_Id, p_Employee_No, p_Work_Date, p_Project_No, p_Task_No;
EXIT WHEN v_cur_01%NOTFOUND;
          BEGIN
          SELECT outlinelevel,SUBSTR(TRIM(externalid),1,2) INTO v_outlinelevel,v_l2_task_code FROM tasks WHERE taskid = p_task_no;
          EXCEPTION          
          WHEN OTHERS THEN
               v_outlinelevel := -1;
          END;     
          IF (v_outlinelevel > 0) THEN
          IF (v_outlinelevel = 3) THEN
          BEGIN
               SELECT SUBSTR(TRIM(t1.externalid),1,2) INTO p_parent_task_code FROM tasks t1 JOIN tasks t2
               ON (t1.taskid = t2.parentid AND t2.taskid=p_task_no);
          EXCEPTION
               WHEN OTHERS THEN
                    v_flag := v_flag + 1;
               p_parent_task_code := NULL;
               v_log := v_log || ' Error occurred when getting Passport Work Order / Task Info. ' ||TRIM(SUBSTR(SQLERRM,1,255));
          END;
          ELSIF (v_outlinelevel = 2) THEN
               p_parent_task_code := v_l2_task_code;
          END IF;
          END IF;
     IF ( p_parent_task_code IS NOT NULL ) THEN               
               BEGIN
     v_cur_code2 := 'Select SUBSTR(Description,1,5), Hours From TimeTransactions Where TimeId = :p_Time_Id AND ownerid = :p_owner';
     OPEN v_cur_02 FOR v_cur_code2 USING p_Time_Id, p_ownerid;
     LOOP
          FETCH v_cur_02 INTO p_Service_Code, p_Hours_Worked;     
          EXIT WHEN v_cur_02%NOTFOUND;
          IF (p_Service_Code IS NOT NULL OR p_Service_Code <> '') THEN
          SELECT Int_Sequence_No.NEXTVAL INTO p_Sequence_No FROM Dual;
          INSERT INTO int_exp_time_trigger(Header_Id, Sequence_No, Employee_No, Work_Date, Project_No, Task_No, Service_Code, Premium_Code, Premium_Cost, Submitted_By, Submitted_Time, Approved_By, Hours_Worked, TIMESTAMP, status)
     VALUES(p_Header_Id, p_Sequence_No, p_Employee_No, p_Work_Date, p_Project_No, p_parent_task_code, p_Service_Code, '000', 0, p_Submitted_By, (p_Submitted_Time), p_Approved_By, p_Hours_Worked, CURRENT_DATE, 'R');
          wep_int_logging.saveline('trigger',1,NVL(p_header_id,0),NVL(p_sequence_no,0),' Time Report exported successfully.');
               ELSE
               v_flag := v_flag + 1;
               wep_int_logging.saveline('trigger',3,NVL(p_header_id,0),0,' Time Report exported error. Service Code can not be null. (Ownerid='||p_ownerid||', Employeeno='||p_employee_no||', Work Date='||p_work_date||')');     
END IF;          
END LOOP;
     v_cur_code3 := 'Select SubStr(ExpenseType,1,5), ExpenseAmount From Expense Where TimeId = :p_Time_Id AND ownerid = :p_owner';
     OPEN v_cur_03 FOR v_cur_code3 USING p_Time_Id, p_ownerid;
     LOOP
          FETCH v_cur_03 INTO p_Premium_Code, p_Premium_Cost;     
          EXIT WHEN v_cur_03%NOTFOUND;
          IF (p_Premium_Code IS NOT NULL OR p_Premium_Code <> '') THEN
               SELECT Int_Sequence_No.NEXTVAL INTO p_Sequence_No FROM Dual;
               INSERT INTO int_exp_time_trigger(Header_Id, Sequence_No, Employee_No, Work_Date, Project_No, Task_No, Service_Code, Premium_Code, Premium_Cost, Submitted_By, Submitted_Time, Approved_By, Hours_Worked, TIMESTAMP, status)
          VALUES(p_Header_Id, p_Sequence_No, p_Employee_No, p_Work_Date, p_Project_No, p_parent_task_code, 'REG', p_Premium_Code, p_Premium_Cost, p_Submitted_By, (p_Submitted_Time), p_Approved_By, 0, CURRENT_DATE, 'R');
          wep_int_logging.saveline('trigger',1,NVL(p_header_id,0),NVL(p_sequence_no,0),' Time Report exported successfully.');
               ELSE
               v_flag := v_flag + 1;
               wep_int_logging.saveline('trigger',3,NVL(p_header_id,0),NVL(p_sequence_no,0),' Time Report exported error. Premium Code can not be null.(Ownerid='||p_ownerid||', Employeeno='||p_employee_no||', Work Date='||p_work_date||')');     
          END IF;
END LOOP;
               EXCEPTION
               WHEN OTHERS THEN
                    v_flag := v_flag + 1;
          wep_int_logging.saveline('trigger',3,NVL(p_header_id,0),NVL(p_sequence_no,0),' Time Report exported failed: (Ownerid='||p_ownerid||', Work Date='||p_work_date||'). Error: '||v_log||' '||SUBSTR(SQLERRM,1,255));
               END;
          ELSE
          v_flag := v_flag + 1;
          wep_int_logging.saveline('trigger',3,NVL(p_header_id,0),0,' (Ownerid='||p_ownerid||', Work Date='||p_work_date||'). Error: '||v_log);
     END IF;     
END LOOP;
     ELSE
     v_flag := v_flag + 1;
wep_int_logging.saveline('trigger',3,NVL(p_header_id,0),0,' Submitted_by / Approved_by can not be null. Error: '||v_log);
     END IF;      
     ELSE
     v_flag := v_flag + 1;
wep_int_logging.saveline('trigger',3,0,0,' Interface Header table data generated Error: '||v_log);
     END IF;     
     IF (v_flag = 0) THEN
     UPDATE int_header_t01 SET status = 'R' WHERE ID = p_header_id;
     ELSE
     UPDATE int_header_t01 SET status = 'E' WHERE ID = p_header_id;
     END IF;
     IF (v_cur_01%ISOPEN) THEN
     CLOSE v_cur_01;
     END IF;
     IF (v_cur_02%ISOPEN) THEN
     CLOSE v_cur_02;
     END IF;
     IF (v_cur_03%ISOPEN) THEN
     CLOSE v_cur_03;
     END IF;
     EXCEPTION
     WHEN OTHERS THEN
     v_log := v_log || SUBSTR(SQLERRM,1,255);
          IF (p_header_id > 0) THEN
          UPDATE int_header_t01 SET status = 'E' WHERE ID = p_header_id;
          END IF;
          wep_int_logging.saveline('trigger',4,CASE WHEN p_header_id > 0 THEN p_header_id ELSE 0 END,0,' Error: '||v_log);
          IF (v_cur_01%ISOPEN) THEN
          CLOSE v_cur_01;
          END IF;
          IF (v_cur_02%ISOPEN) THEN
          CLOSE v_cur_02;
          END IF;
          IF (v_cur_03%ISOPEN) THEN
          CLOSE v_cur_03;
          END IF;
END;
/

Similar Messages

  • Use Global Temp Table to overcome Mutating Trigger issue

    Hello all. I need to delete a line in a table, and thought I would get around the mutating trigger issue by creating a GTB table. I created 2 different triggers. One is a Row level trigger, the other a Statement level trigger.
    The first trigger gathers the information I need to identify the line I want to delete. This is:
    CREATE OR REPLACE TRIGGER Requisition_Capture
    AFTER UPDATE OF Delivery_Code on Supply_Items
    FOR EACH ROW
    BEGIN
      IF :NEW.Delivery_Code = '#' THEN
        INSERT INTO Requisition_Storage
          (Req_Code)
        VALUES
          (:NEW.Requisition_Code);
      END IF;
    END;And the second trigger deletes the line:
    CREATE OR REPLACE TRIGGER SUPPLY_ITEM_RESET
    AFTER INSERT ON Requisition_Storage
    DECLARE
    BEGIN
      DELETE FROM Supply_Items r
       WHERE r.Requisition_Code =
             (SELECT t.Req_Code
                FROM Requisition_Storage t, Supply_Items s
               WHERE t.Req_Code = s.Requisition_Code)
         AND r.Order_Qty = 0;
    END;The GTB is as follows stores the information I need to delete the line.:
    -- Create table
    create global temporary table REQUISITION_STORAGE
      req_code VARCHAR2(20)
    on commit delete rows;When the column Delivery_Code is updated in the Supply_Item table, and the value is reset to '#', I want to capture the Requisition_Code in the GTB, so I can run the statement level trigger and delete the reset row. However, I still have a mutating error problem. What am I missing?

    The statement level trigger would need to be an AFTER UPDATE OF Supply_Items for this to work around the mutating trigger issue. You need to ensure that your UPDATE has finished updating all the rows that it is going to update before your statement-level trigger runs.
    As has been pointed out, however, the desire to work around a mutating trigger error almost always indicates that you have a data model problem. And you're almost always better served by fixing the data model than working around the error.
    Justin

  • Dynamic build of a table trigger - Issue building :new and :old vars

    (which leads me to my next issue - this one might be a deal killer for me; see "Are Optional Parameters possible in Procedural Units?"
    I'm using a Select statement to dynamically create a table trigger which looks like the following:
    create or replace trigger tr_audit#reporter
    after update on reporter
    for each row
    begin
    ttms_audit_pkg.insert_audit_info( 'reporter', 'ZIP', :new.ZIP, :old.ZIP, 'REPORTER.REPORTER,REPORTER.PROJECT_CD', 'EXFC', :new.reporter, :new.project_cd);
    end;
    The :new. and :old. variables are generated based on which table_name is passed to the script creating this trigger. My problem is that I need all the :new. and :old. parameters to be passed in as Char. regardless of whether they are Number or Date variables.
    So in the example above...if :new.reporter is a number on the table then I need to to_char is like this:
    create or replace trigger tr_audit#reporter
    after update on reporter
    for each row
    begin
    ttms_audit_pkg.insert_audit_info( 'reporter', 'ZIP', :new.ZIP, :old.ZIP,
    'REPORTER.REPORTER,REPORTER.PROJECT_CD', 'EXFC', to_char(:new.reporter), :new.project_cd);
    end;
    However, since this trigger is created dynamically I will not know in advance which :new. and :old. parameters will need to be converted to character. So if to_char(:new.reporter) is used and :new.reporter is already a character on the table then I will get an error.
    So my question then is this. Is there a way to write this dynamic sql in a way to accomidate this problem? I'm thinking something that would act a bit like a decode does with values...pehaps something like this:
    decode(:new.reporter, NUMBER, to_char(:new.reporter), DATE, to_char(:new.reporter,'DD-MON-YYYY HH12:MIPM'), :new.reporter)
    ...if :new.reporter is a number then to_char it; if :new.reporter is a date then to_char it; otherwise let it be.
    By any chance does anyone know if this is possible? I would greatly appreciate any insights.

    Sure, you can selectively version-enable tables using Workspace Manager (you call DBMS_WM.EnableVersioning on each table you want Workspace Manager to track history for).
    What do you mean by "programmatically rollback changes"? Workspace Manager has the ability to call GotoTime and queries against a version-enabled table will return results as if you were querying it at that specific point in time (unless you've purged history of course). You can also use it to create what are essentially long-running transactions where you can work on multiple sets of proposed data changes simultaneously for days or months before finally deciding to commit a one particular set. It's incredibly powerful.
    Justin

  • Trigger issues

    Hi guys,
    I'm having an issue with a trigger but I don't think it's the trigger causing the problem:
    I have a table called mytable (actual name withheld to protect the innocent)
    Which has a trigger which inserts into an audit table every time there is an insert/update/deletion from mytable.
    See code below:
    Create table auditdebug
    (timestamp date,
    Old clob,
    New clob,
    Type varchar2(100));
    Create table mytable
    (id number,
    clobcolumn clob);
    CREATE OR REPLACE TRIGGER mytriggername
    after insert or update or delete on mytable
    for each row
    begin
      case
        when inserting then
          insert into auditdebug (timestamp, old, new, type) values (sysdate,:old.clobcolumn,:new.clobcolumn,'insert');
        when updating then
          insert into auditdebug (timestamp, old, new, type) values (sysdate,:old.clobcolumn,:new.lobcolumn,'update');
        when deleting then
          insert into auditdebug (timestamp, old, new, type) values (sysdate,:old.clobcolumn,:new.clobcolumn,'delete');
      end case;
    end;This is working absolutely fine when I update the mytable table via a directly inputted update statement in sql*plus etc.
    However
    The same table is updated/inserted into via an oracle form and the :new.query_text is inserted into my audit table as an empty clob while the true new value still goes through into the MYTABLE table as expected.
    I'm stumped as to how this could happen. The :new.clobcolumn doesn't get into my audit table, but the MYTABLE table is updated/inserted into correctly!!!!
    Thoughts? Where do I look next?

    ok, so an update:
    forgot my oracle version for a start:
    it's 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
    oracle forms version is 6i which was intended for the database version 8i I think.
    the form that looks at the table has the clob value column as a LONG datatype and not a CLOB. forms 6i doesn't appear to have CLOB as an option (although I've got very little experience with forms).
    the trigger works fine when I update the table in a script or manually as you have done, it's just something goes funny when the table is updated via the oracle form.
    --doing some more tests and will come back if I get anything..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Auto number by sequence and trigger - issue

    Hi,
    i need to insert auto number in one of the column of my table, and i tried like the following way..
    CREATE TABLE STOP_TRACKING
      ID                    NUMBER                           primary key,
      MSISDN                NUMBER                  NOT NULL,
      TIME_STAMP            DATE                    DEFAULT SYSDATE,
      STOP_TRACKING_RESULT  NUMBER,
      REQUEST_ID            VARCHAR2(60 BYTE)
    TABLESPACE SYSTEM
    PCTUSED    40
    PCTFREE    10
    INITRANS   1
    MAXTRANS   255
    STORAGE    (
                INITIAL          64K
                MINEXTENTS       1
                MAXEXTENTS       2147483645
                PCTINCREASE      0
                FREELISTS        1
                FREELIST GROUPS  1
                BUFFER_POOL      DEFAULT
    LOGGING
    NOCACHE
    NOPARALLEL;
    COMMENT ON COLUMN STOP_TRACKING.STOP_TRACKING_RESULT IS 'IF RESULT ID "0" - OK AND IF RESULT ID "1" - NOT OK';
    create sequence seq_autonumber;
    CREATE OR REPLACE TRIGGER trg_autonumber
    BEFORE INSERT ON STOP_TRACKING
    FOR EACH ROW
    WHEN (new.id IS NULL)
    BEGIN
      SELECT seq_autonumber.NEXTVAL
      INTO   :new.id
      FROM   STOP_TRACKING;
    END;
    /when i execute the create trigger sql in toad sql editor am getting a pop up saying
    >
    variable name:NEW
    Type: drop down list ...here i tried almost relevant data types, int,long,....
    Value:...here i entered 1
    and clicked ok...and got the error as
    ORA-01036: illegal variable name/number
    >
    what could be issue?
    Edited by: Aemunathan on Nov 22, 2009 2:55 PM

    I just copy pasted your code.
    Works just fine.
    I believe you issue is realed to TOAD rather than pl/sql.
    Would have loved to help you but i use pl/sql developer.
    However if possible send a screen shot.
    Cheers!!!
    Bhushan

  • After Update Trigger issue

    Hello,
    I am having a problem with after update trigger. I have created an after update trigger in Oracle that would call a procedure to run an Oracle report. The problem is that when the report is run, the table is not updated yet. So the table passes old values to the report. Is there any way I can take care of this issue? How do I make sure the table is updated before running the report? I tried delaying the report by using dbms_job package. I didn't have any success with that. Probably I am doing something wrong. This is the code I used
    dbms_job.submit( job => l_job, what => 'SendPDFReport(:new.query_id,serviceid,:new.site_id);', next_date => sysdate+3/24*60 );
    Thanks
    Oracle database User

    It is working. I used the same code,but I was using parameters inside the single quote, so it was taking the parameter value as :new.query_id instead of 12345.
    I made changes
    from
    dbms_job.submit( job => l_job, what => 'SendPDF(:new.query_id,serviceid,:new.site_id);', next_date => sysdate);
    to
    dbms_job.submit( job => l_job, what => 'SendPDF('||:new.query_id||','||serviceid||','||:new.site_id||');', next_date => sysdate);
    Thanks for all your help.

  • 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;

  • Tektronix DO4104 Scope Trigger issue

    I'm having the same issue the fellow in this thread was having: http://forums.ni.com/t5/LabVIEW/Tek-7104-Triggering-problem/m-p/948510
    I would like the scope to wait for the trigger, such that, if I set the trigger voltage at 4 volts, then feed it a square wave that never reaches 4 volts, it never trigger and will simply wait for the timeout that I fed it in the "Maximum Time" field of the example VI. The description for the Read (Single Waveform) VI states "A timeout error can occur when the trigger level is out of the range of the waveform" when referring to the timeout that I input, but I put 10 seconds, and it definitely doesn't wait even one second.
    Any ideas?
    I'm in Labview 7.1
    Thank you,
    -Jason 

    John_M. wrote:
    Hi Jason,
    I just wanted to clarify with you that I am understanding correctly. Let's assume you specify a trigger voltage of 4 volts and a read timeout of 10 seconds. Then if you input a square wave with an amplitude of 3 volts, the read does not wait for 10s? Do you get a timeout error after some amount of time? Or what happens after that amount of time?
    Yes, that is exactly the case. If I give it a 3v square wave and a trigger voltage that it will never reach, and a read timeout of 10 seconds, it doesn't wait and just finishes running and show a 0 waveform when it should wait 10 seconds until there's a trigger, and then output the data. I just went to the lab to test this again to make sure, and that was the exact behavior.
    John_M. wrote:
    Also, I took a look at the driver you mentioned. Are you using the "tkdpo4k Edge Triggered Acquisition Waveform Example"? If not, which one?
    Also, what exactly is the value that you have specified for the Maximum Time? The value is in miliseconds. So a value of 10,000 should correspond to 10 seconds. Lastly, what have you set for Vertical Coupling?
    Best Regards,
    John M
    Yes, I am running the "tkdpo4k Edge Triggered Acquisition Waveform Example.vi."
     For maximum time I increased it to 20000 from 10000, same exact program behavior. For vertical coupling, I have it set to DC.

  • INSTEAD OF TRIGGER Issue

    The following is the select statement for which I have created the view:
    (SELECT person.person_id, person.employee_number worker_number,
    pps.actual_termination_date, pps.date_start start_date,
    ppt.system_person_type,
    hr_person_type_usage_info.get_user_person_type
    (TRUNC (SYSDATE),
    person.person_id
    ) user_person_type,
    person.full_name, person.last_name, person.first_name,
    person.middle_names middle_initial, person.known_as preferred_name,
    person.mailstop mail_stop, person.office_number roomnumber,
    DECODE
    ('Y',
    (SELECT 'Y'
    FROM DUAL
    WHERE EXISTS (
    SELECT 'Y'
    FROM per_all_assignments_f sup
    WHERE sup.supervisor_id = person.person_id
    AND TRUNC (SYSDATE)
    BETWEEN sup.effective_start_date
    AND NVL (sup.effective_end_date,
    TRUNC (SYSDATE)
    OR EXISTS (
    SELECT 'Y'
    FROM per_all_assignments_f paaf, per_jobs mgr
    WHERE paaf.person_id = person.person_id
    AND TRUNC (SYSDATE)
    BETWEEN paaf.effective_start_date
    AND NVL (paaf.effective_end_date,
    TRUNC (SYSDATE)
    AND paaf.job_id = mgr.job_id
    AND UPPER (mgr.NAME) LIKE '%MANAGER%')), 'Y',
    'N'
    ) manager_flag,
    (SELECT supervisor.full_name
    FROM per_all_people_f supervisor
    WHERE supervisor.person_id = asg.supervisor_id
    AND TRUNC (SYSDATE) BETWEEN supervisor.effective_start_date
    AND supervisor.effective_end_date)
    supervisor,
    job.NAME job_name, pay.payroll_name payroll_name,
    asg.ass_attribute6 cc,
    (SELECT DISTINCT ffv.description
    FROM fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name = 'VS_GL_COMPANY_GLOBAL'
    AND ffv.enabled_flag = 'Y'
    AND TRUNC (SYSDATE)
    BETWEEN TRUNC (NVL (ffv.start_date_active,
    SYSDATE
    AND TRUNC (NVL (ffv.end_date_active,
    SYSDATE
    AND ffv.flex_value = SUBSTR (asg.ass_attribute6, 1, 3))
    company,
    (SELECT DISTINCT ffv.description
    FROM fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name =
    'VS_GL_BUSINESS_UNIT_GLOBAL'
    AND ffv.enabled_flag = 'Y'
    AND TRUNC (SYSDATE)
    BETWEEN TRUNC (NVL (ffv.start_date_active,
    SYSDATE
    AND TRUNC (NVL (ffv.end_date_active,
    SYSDATE
    AND ffv.flex_value = SUBSTR (asg.ass_attribute6, 5, 4))
    business,
    (SELECT DISTINCT ffv.description
    FROM fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name =
    'VS_GL_DEPARTMENT_GLOBAL'
    AND ffv.enabled_flag = 'Y'
    AND TRUNC (SYSDATE)
    BETWEEN TRUNC (NVL (ffv.start_date_active,
    SYSDATE
    AND TRUNC (NVL (ffv.end_date_active,
    SYSDATE
    AND ffv.flex_value =
    SUBSTR (asg.ass_attribute6, 10, 4))
    department,
    loc.location_code location_name,
    DECODE (loc.style,
    'JP', (loc.address_line_1 || ' ' || address_line_2),
    'JP_GLB', (loc.address_line_1 || ' ' || address_line_2),
    ( loc.address_line_1
    || ' '
    || address_line_2
    || ' '
    || address_line_3
    ) location_address,
    DECODE (loc.style,
    'JP', address_line_3,
    'JP_GLB', address_line_3,
    town_or_city
    ) location_city,
    loc.region_2 location_state, loc.country location_country,
    loc.postal_code location_zip,
    (SELECT ph.phone_number
    FROM per_phones ph
    WHERE ph.party_id = person.party_id
    AND ph.phone_type = 'W1'
    AND TRUNC (SYSDATE) BETWEEN ph.date_from
    AND NVL (ph.date_to, TRUNC (SYSDATE))
    AND ph.date_from =
    (SELECT MAX (p.date_from)
    FROM per_phones p
    WHERE p.party_id = ph.party_id
    AND p.phone_type = 'W1'
    AND p.date_from <= TRUNC (SYSDATE))) work_number,
    (SELECT ph.phone_number
    FROM per_phones ph
    WHERE ph.party_id = person.party_id
    AND ph.phone_type = 'W2'
    AND TRUNC (SYSDATE) BETWEEN ph.date_from
    AND NVL (ph.date_to, TRUNC (SYSDATE))
    AND ph.date_from =
    (SELECT MAX (p.date_from)
    FROM per_phones p
    WHERE p.party_id = ph.party_id
    AND p.phone_type = 'W2'
    AND p.date_from <= TRUNC (SYSDATE))) voip_number,
    (SELECT ph.phone_number
    FROM per_phones ph
    WHERE ph.party_id = person.party_id
    AND ph.phone_type = 'M'
    AND TRUNC (SYSDATE) BETWEEN ph.date_from
    AND NVL (ph.date_to, TRUNC (SYSDATE))
    AND ph.date_from =
    (SELECT MAX (p.date_from)
    FROM per_phones p
    WHERE p.party_id = ph.party_id
    AND p.phone_type = 'M'
    AND p.date_from <= TRUNC (SYSDATE)))
    mobile_public_number,
    person.attribute5 acquisition_name,
    person.attribute6 acquisition_date, ad.email,
    ad.legacy_email, ad.primary_email_flag, ad.sam_account_name,
    ad.guid, ad.last_oracle_update_date, ad.last_ad_update_date,
    ad.opt_out_flag
    FROM per_all_people_f person,
    per_periods_of_service pps,
    per_all_assignments_f asg,
    per_person_types ppt,
    per_person_type_usages_f pptu,
    hr_locations loc,
    per_jobs job,
    pay_payrolls_f pay,
    xxvs_hr_sync_ad ad
    WHERE person.person_id = asg.person_id
    AND ad.person_id(+) = person.person_id
    AND TRUNC (SYSDATE) BETWEEN person.effective_start_date
    AND person.effective_end_date
    AND TRUNC (SYSDATE) BETWEEN asg.effective_start_date
    AND asg.effective_end_date
    AND asg.primary_flag = 'Y'
    AND ( ( asg.assignment_type = 'B'
    AND person.current_employee_flag IS NULL
    OR ( asg.assignment_type = 'E'
    AND person.current_employee_flag IS NOT NULL
    AND person.person_id = pps.person_id
    AND pps.date_start = (SELECT MAX (pps1.date_start)
    FROM per_periods_of_service pps1
    WHERE pps1.person_id = pps.person_id)
    AND pps.date_start >=
    NVL ((SELECT MAX (ppp1.date_start)
    FROM per_periods_of_placement ppp1
    WHERE ppp1.person_id = pps.person_id
    AND ppp1.date_start <= TRUNC (SYSDATE)),
    pps.date_start
    AND person.employee_number IS NOT NULL
    AND person.person_id = pptu.person_id
    AND TRUNC (SYSDATE) BETWEEN pptu.effective_start_date
    AND pptu.effective_end_date
    AND pptu.person_type_id = ppt.person_type_id
    AND ppt.active_flag = 'Y'
    AND ppt.system_person_type IN
    ('EMP', 'EX_EMP') -- only employees and ex-employees.
    AND ppt.business_group_id = person.business_group_id
    AND NOT EXISTS (
    SELECT 'x'
    FROM per_person_type_usages_f pptu1, per_person_types ppt1
    WHERE pptu1.person_id = person.person_id
    AND pptu1.effective_end_date =
    NVL (pps.actual_termination_date,
    TO_DATE ('31-DEC-4712', 'DD-MON-YYYY')
    AND pptu1.person_type_id = ppt1.person_type_id
    AND ppt1.business_group_id = person.business_group_id
    AND ppt1.user_person_type = 'Contract Labor')
    AND asg.location_id = loc.location_id(+)
    AND asg.job_id = job.job_id(+)
    AND asg.payroll_id = pay.payroll_id(+)
    AND TRUNC (SYSDATE) BETWEEN NVL (pay.effective_start_date(+),
    TRUNC (SYSDATE))
    AND NVL (pay.effective_end_date(+),
    TRUNC (SYSDATE)))
    UNION ALL
    (SELECT person.person_id, person.npw_number worker_number,
    ppp.actual_termination_date, ppp.date_start start_date,
    ppt.system_person_type,
    hr_person_type_usage_info.get_user_person_type
    (TRUNC (SYSDATE),
    person.person_id
    ) user_person_type,
    person.full_name, person.last_name, person.first_name,
    person.middle_names middle_initial, person.known_as preferred_name,
    person.mailstop mail_stop, person.office_number roomnumber,
    DECODE
    ('Y',
    (SELECT 'Y'
    FROM DUAL
    WHERE EXISTS (
    SELECT 'Y'
    FROM per_all_assignments_f sup
    WHERE sup.supervisor_id = person.person_id
    AND TRUNC (SYSDATE)
    BETWEEN sup.effective_start_date
    AND NVL (sup.effective_end_date,
    TRUNC (SYSDATE)
    OR EXISTS (
    SELECT 'Y'
    FROM per_all_assignments_f paaf, per_jobs mgr
    WHERE paaf.person_id = person.person_id
    AND TRUNC (SYSDATE)
    BETWEEN paaf.effective_start_date
    AND NVL (paaf.effective_end_date,
    TRUNC (SYSDATE)
    AND paaf.job_id = mgr.job_id
    AND UPPER (mgr.NAME) LIKE '%MANAGER%')), 'Y',
    'N'
    ) manager_flag,
    (SELECT supervisor.full_name
    FROM per_all_people_f supervisor
    WHERE supervisor.person_id = asg.supervisor_id
    AND TRUNC (SYSDATE) BETWEEN supervisor.effective_start_date
    AND supervisor.effective_end_date)
    supervisor,
    job.NAME job_name, pay.payroll_name payroll_name,
    asg.ass_attribute6 cc,
    (SELECT DISTINCT ffv.description
    FROM fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name = 'VS_GL_COMPANY_GLOBAL'
    AND ffv.enabled_flag = 'Y'
    AND TRUNC (SYSDATE)
    BETWEEN TRUNC (NVL (ffv.start_date_active,
    SYSDATE
    AND TRUNC (NVL (ffv.end_date_active,
    SYSDATE
    AND ffv.flex_value = SUBSTR (asg.ass_attribute6, 1, 3))
    company,
    (SELECT DISTINCT ffv.description
    FROM fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name =
    'VS_GL_BUSINESS_UNIT_GLOBAL'
    AND ffv.enabled_flag = 'Y'
    AND TRUNC (SYSDATE)
    BETWEEN TRUNC (NVL (ffv.start_date_active,
    SYSDATE
    AND TRUNC (NVL (ffv.end_date_active,
    SYSDATE
    AND ffv.flex_value = SUBSTR (asg.ass_attribute6, 5, 4))
    business,
    (SELECT DISTINCT ffv.description
    FROM fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name =
    'VS_GL_DEPARTMENT_GLOBAL'
    AND ffv.enabled_flag = 'Y'
    AND TRUNC (SYSDATE)
    BETWEEN TRUNC (NVL (ffv.start_date_active,
    SYSDATE
    AND TRUNC (NVL (ffv.end_date_active,
    SYSDATE
    AND ffv.flex_value =
    SUBSTR (asg.ass_attribute6, 10, 4))
    department,
    loc.location_code location_name,
    DECODE (loc.style,
    'JP', (loc.address_line_1 || ' ' || address_line_2),
    'JP_GLB', (loc.address_line_1 || ' ' || address_line_2),
    ( loc.address_line_1
    || ' '
    || address_line_2
    || ' '
    || address_line_3
    ) location_address,
    DECODE (loc.style,
    'JP', address_line_3,
    'JP_GLB', address_line_3,
    town_or_city
    ) location_city,
    loc.region_2 location_state, loc.country location_country,
    loc.postal_code location_zip,
    (SELECT ph.phone_number
    FROM per_phones ph
    WHERE ph.party_id = person.party_id
    AND ph.phone_type = 'W1'
    AND TRUNC (SYSDATE) BETWEEN ph.date_from
    AND NVL (ph.date_to, TRUNC (SYSDATE))
    AND ph.date_from =
    (SELECT MAX (p.date_from)
    FROM per_phones p
    WHERE p.party_id = ph.party_id
    AND p.phone_type = 'W1'
    AND p.date_from <= TRUNC (SYSDATE))) work_number,
    (SELECT ph.phone_number
    FROM per_phones ph
    WHERE ph.party_id = person.party_id
    AND ph.phone_type = 'W2'
    AND TRUNC (SYSDATE) BETWEEN ph.date_from
    AND NVL (ph.date_to, TRUNC (SYSDATE))
    AND ph.date_from =
    (SELECT MAX (p.date_from)
    FROM per_phones p
    WHERE p.party_id = ph.party_id
    AND p.phone_type = 'W2'
    AND p.date_from <= TRUNC (SYSDATE))) voip_number,
    (SELECT ph.phone_number
    FROM per_phones ph
    WHERE ph.party_id = person.party_id
    AND ph.phone_type = 'M'
    AND TRUNC (SYSDATE) BETWEEN ph.date_from
    AND NVL (ph.date_to, TRUNC (SYSDATE))
    AND ph.date_from =
    (SELECT MAX (p.date_from)
    FROM per_phones p
    WHERE p.party_id = ph.party_id
    AND p.phone_type = 'M'
    AND p.date_from <= TRUNC (SYSDATE)))
    mobile_public_number,
    person.attribute5 acquisition_name,
    person.attribute6 acquisition_date, ad.email,
    ad.legacy_email, ad.primary_email_flag, ad.sam_account_name,
    ad.guid, ad.last_oracle_update_date, ad.last_ad_update_date,
    ad.opt_out_flag
    FROM per_all_people_f person,
    per_periods_of_placement ppp,
    per_all_assignments_f asg,
    per_person_types ppt,
    per_person_type_usages_f pptu,
    hr_locations loc,
    per_jobs job,
    pay_payrolls_f pay,
    xxvs_hr_sync_ad ad
    WHERE person.person_id = asg.person_id
    AND ad.person_id(+) = person.person_id
    AND TRUNC (SYSDATE) BETWEEN person.effective_start_date
    AND person.effective_end_date
    AND asg.primary_flag = 'Y'
    AND asg.assignment_type = 'C'
    AND asg.effective_start_date =
    (SELECT MAX (asg1.effective_start_date)
    FROM per_all_assignments_f asg1
    WHERE asg1.person_id = asg.person_id
    AND asg1.assignment_type = 'C'
    AND asg1.primary_flag = 'Y')
    AND person.person_id = ppp.person_id
    AND ppp.date_start = (SELECT MAX (ppp1.date_start)
    FROM per_periods_of_placement ppp1
    WHERE ppp1.person_id = ppp.person_id)
    AND ppp.date_start >=
    NVL ((SELECT MAX (pps1.date_start)
    FROM per_periods_of_service pps1
    WHERE pps1.person_id = ppp.person_id
    AND pps1.date_start <= TRUNC (SYSDATE)),
    ppp.date_start
    AND person.npw_number IS NOT NULL
    AND person.person_id = pptu.person_id
    AND TRUNC (SYSDATE) BETWEEN pptu.effective_start_date
    AND pptu.effective_end_date
    AND pptu.person_type_id = ppt.person_type_id
    AND ppt.active_flag = 'Y'
    AND ppt.system_person_type IN ('CWK', 'EX_CWK') -- only CWK and ex-CWK.
    AND ppt.business_group_id = person.business_group_id
    AND asg.location_id = loc.location_id(+)
    AND asg.job_id = job.job_id(+)
    AND asg.payroll_id = pay.payroll_id(+)
    AND TRUNC (SYSDATE) BETWEEN NVL (pay.effective_start_date(+),
    TRUNC (SYSDATE))
    AND NVL (pay.effective_end_date(+),
    TRUNC (SYSDATE)))
    Update of per_all_people_f is firing the trigger while insert is not working...Please help.Is that bcz I have a outer join between per_all_people_f and xxvs_hr_sync_ad ?
    Following is my trigger:
    create or replace trigger XXVS_HR_SYNC_AD_T
    Instead of update or insert
    on xxvs_hr_ad_v
    for each row
    begin
    --raise_application_error('updates are prohibited')
    raise_application_error(-116,'error occured while inserting');
    insert into temp10 values ('New Person Id'||:new.person_id);
    insert into temp10 values ('Old Person Id'||:old.person_id);
    insert into temp10 values ('New email'||:new.email);
    insert into temp10 values ('Old email'||:old.email);
    insert into temp10 values('New account'||:new.sam_account_name);
    insert into temp10 values('Old account'||:old.sam_account_name);
    commit;
    raise_application_error(-117,'error occured while inserting');
    IF (:new.person_id=:old.person_id) and
    ((:new.email <>:old.email) or
    (:new.sam_account_name <>:old.sam_account_name)) THEN
    raise_application_error(-118,'error occured while inserting');
    update xxvs_hr_sync_ad
    set email =:new.email,
    sam_account_name=:new.sam_account_name
    where person_id =:old.person_id;
    if sql%rowcount = 0 then
    insert into XXVS_HR_SYNC_AD
    (PERSON_ID
    ,email
    ,sam_account_name)
    values
    (:new.person_id,:new.email,:new.sam_account_name);
    END IF;
    END IF;
    end;
    /

    Statements between /* */ are used for debugging purpose.
    Requirement is if there is an insert or update on per_all_people_f I need to perform insert or update in my staging table ie;xxvs_hr_sync_ad
    If there is an update on per_all_people_f trigger is working fine,for insert it is not working.
    create or replace trigger XXVS_HR_SYNC_AD_T
    Instead of update or insert
    on xxvs_hr_ad_v
    for each row
    begin
    --raise_application_error('updates are prohibited')
    raise_application_error(-116,'error occured while inserting');
    insert into temp10 values ('New Person Id'||:new.person_id);
    insert into temp10 values ('Old Person Id'||:old.person_id);
    insert into temp10 values ('New email'||:new.email);
    insert into temp10 values ('Old email'||:old.email);
    insert into temp10 values('New account'||:new.sam_account_name);
    insert into temp10 values('Old account'||:old.sam_account_name);
    commit;
    raise_application_error(-117,'error occured while inserting');
    IF (:new.person_id=:old.person_id) and.........
    Thanks

  • Regarding output type and idoc trigger issue

    Hi
    i need to copy pgi quantity into sales order quantity for that i write a code into user exit MV50AFZ1. code is working fine but
    output type and idoc is not trigger due to this. In this exit to update sales order quantity i used bapi *BAPI_SALESORDER_CHANGE . can anyone tell me why o/p type and idoc not trigger ,what is the reason and what is the solution for this?
    Thanks
    Dinesh

    Hi Dinesh,
    Did you activate the enhancement for user exit ?
    Did you check if the output type is configured correctly ?
    Put a debugging point and see if control is coming there.
    Regards,
    Nisha Vengal.

  • Pre-query trigger issue

    Hi,
    I have a datablock in the form that is based on a DB table. There are few queriable fields in the block including begin and end dates. If i dont use any pre-query trigger, the records are queried fine. But I want to do a range selection between begin and end_Date fields. Therefore I created a pre-query trigger and set a new_where_clause with all my query_fields and set that as defualt where for my DB block.
    SET_BLOCK_PROPERTY (block_id,default_where, where_clause);
    But when I see the query in toad session , the query looks like
    WHERE (field_1 = :1) and field_1 = :1
    that means its running the defualt where clause on the block and the new_where clause at the same time.
    I checked the form and I dont have any calls to execute query....
    what can be the problem?

    1. What is your new_where_clause? (example, please)It's hard to read. Use the \{code\} tag.
    FUNCTION get_comparison_phrase (database_column_name       VARCHAR2,
                                                             relational_operator       VARCHAR2,
                                                             selection_field_name       VARCHAR2)
              RETURN VARCHAR2 IS
         BEGIN
              RETURN CASE
                              WHEN NAME_IN (selection_field_name) IS NOT NULL THEN
                                        ' AND '
                                   || database_column_name
                                   || relational_operator
                                   || ' :'
                                   || selection_field_name
                              ELSE
                                   NULL
                         END;
         END get_comparison_phrase;
    where_clause := 'WHERE (1=1)';
    if NAME_IN (selection_field_name) IS NOT NULL THEN       ' AND '
                                   || database_column_name
                                   || relational_operator
                                   || ' :'
                                   || selection_field_name
                              ELSE
                                   NULL
                         END;
    where_clause :=
         where_clause
              || get_comparison_phrase (
                        'screening_group_num',
                        '=',
                        'EXCEPTIONAL_EVENTS.screening_group_num'
    WHERE (field_1 = :1) and field_1 = :1I do not see 'WHERE (1=1)'; there.
    Edited by: Michael Roy on Oct 21, 2009 9:47 AM

  • AQ Configuration Tech Note in Oracle Express DB Trigger issue

    Hi,
    I'm trying to implement the QA Configuration Tech Note (http://www.oracle.com/technology/products/integration/bam/10.1.3/TechNotes/TechNote_BAM_AQ_Configuration.pdf)
    My environment is Windows 2K3 Server, BAM 10.1.3.3, and Oracle DB 10g Express Edition. Everything was going great until I got to Step 4 on page 3. I can't seem to get the trigger to compile. As I researched this I found, much to my surprise, that as much as Oracle AQ is supported in Oracle XE, JMS is not! So, what I would like to know is there another way to get AQ to work from Oracle XE as a way of sending data to BAM? Or, is there some other way of getting a trigger to send a message via JMS? etc.
    Thanks in advance for your suggestions.
    - Jordan.

    Express does not support the Java message types (sys.aq$_jms_text_message) since they require the Oracle JVM which is not included in XE.
    Edit:
    Or I might be wrong ? The following PDF doc uses an XE database. I did not get OJMS working with XE when I tried and now I do not have any local XE instance to try against.
    http://www.oracle.com/technology/products/integration/esb/files/esb-aqjmstodb.pdf
    This blog entry http://mike-lehmann.blogspot.com/2006/09/simple-mdb-with-oracle-database-jms.html
    States:
    If using Oracle XE, the following jar files are required in your classpath to run this example:
    .;%DB_HOME%/RDBMS/jlib/aqapi13.jar;%DB_HOME%/RDBMS/jlib/jmscommon.jar;
    %DB_HOME%/RDBMS/jlib/xdb.jar;%DB_HOME%/lib/xmlparserv2.jar;
    %DB_HOME%/jdbc/lib/ojdbc14.jar;%DB_HOME%/jlib/orai18n.jar;%DB_HOME%/jlib/jndi.jar;%J2EE_HOME%/lib/jta.jar
    Message was edited by:
    olundber_se

  • Post Change trigger issue

    I placed a post change(Item level) trigger to LOV enable item(deptno) and insert the following code there.
    But as expected other block items (dname, loc) of dept block won't come to the form once change the LOV.
    ------------------ code --------------------
    BEGIN
         SET_BLOCK_PROPERTY('dept',DEFAULT_WHERE, 'deptno = ' || :dept.deptno);
         EXECUTE_QUERY;
    END;
    Any solutions
    thax
    Shabar

    shabar,
    the EXECUTE_QUERY cannot be given in POST-CHANGE Trigger.
    I think your requirement is this.
    some departments were already saved.
    if some one tries to create new department with old deptcode, then the actual department details should retrieve.
    if this is the case, then, give the code in the KEY-NEXT-ITEM Trigger.
    and if the deptno field is varchar, then u have to change the code like this,
    DECLARE
    CURSOR Cur_Dept IS SELECT DEPTNO FROM DEPT WHERE DEPTNO = :DEPT.DEPTNO;
    Str_Deptno VARCHAR2(20);
    BEGIN
    IF :DEPT.DEPTNO IS NOT NULL THEN
    OPEN Cur_Dept;
    FETCH Cur_Dept INTO Str_Deptno;
    IF Str_Deptno IS NOT NULL THEN
    SET_BLOCK_PROPERTY('DEPT', DEFAULT_WHERE, 'DEPTNO = ''' || :DEPT.DEPTNO || '''');
    CLEAR_BLOCK(NO_COMMIT);
    EXECUTE_QUERY;
    END IF;
    END IF;
    END;
    Its better to check whether the DEPTNO is valid or not.
    Regards,
    Manu.

  • TFS Build and vNext Release Trigger issue

    When the build definition is set to “True” for release – getting the error even though the Release template was linked to the Build definition.
    ERROR: No release template matching the current build definition was found to create a release and deployment for.
    When flag is reset to false to release - build completes and let the release be created in RM Client and select the latest build.
    Another observation, was able to link the same build definition to both "Agent based" and "vNext" releases at the same time.What could be the wrong we are doing?

    I had exactly the same issue (reported
    here). And have reported this issue in
    Microsoft Connect as well and waiting for their reply 
    Regards, Bharath
    LinkedIn:

  • Trigger Issue while updating same table

    Hi all,
    I am creating one after insert trigger on table tests, which will check, if application id is null, application will be fetched from another table and update the table
    tests table. But this trigger is not updating the application id of the table tests
    CREATE OR REPLACE
    TRIGGER TB_REC_APPL_TESTS1
    AFTER INSERT ON tests FOR EACH ROW
    DECLARE
    v_application_id NUMBER;
    v_rec_appl_tests_id NUMBER;
    v_a_recruit_id NUMBER;
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    v_rec_appl_tests_id := :NEW.rec_appl_tests_id;
    v_a_recruit_id := :NEW.a_recruit_id;
    IF :NEW.a_applic_id IS NULL THEN
    SELECT a_applic_id INTO v_application_id FROM recruit WHERE a_recrut_id = v_a_recruit_id;
    dbms_output.PUT_LINE(v_application_id||'-'||v_rec_appl_tests_id);
    UPDATE tests SET a_applic_id = v_application_id
    WHERE rec_appl_tests_id = v_rec_appl_tests_id;--:NEW.rec_appl_tests_id;
    END IF;
    commit;
    END;
    Thanks in advance,
    Pal

    user546710 wrote:
    Hi all,
    I am creating one after insert trigger on table tests, which will check, if application id is null, application will be fetched from another table and update the table
    tests table. But this trigger is not updating the application id of the table tests
    CREATE OR REPLACE
    TRIGGER TB_REC_APPL_TESTS1
    AFTER INSERT ON tests FOR EACH ROW
    DECLARE
    v_application_id NUMBER;
    v_rec_appl_tests_id NUMBER;
    v_a_recruit_id NUMBER;
    PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    v_rec_appl_tests_id := :NEW.rec_appl_tests_id;
    v_a_recruit_id := :NEW.a_recruit_id;
    IF :NEW.a_applic_id IS NULL THEN
    SELECT a_applic_id INTO v_application_id FROM recruit WHERE a_recrut_id = v_a_recruit_id;
    dbms_output.PUT_LINE(v_application_id||'-'||v_rec_appl_tests_id);
    UPDATE tests SET a_applic_id = v_application_id
    WHERE rec_appl_tests_id = v_rec_appl_tests_id;--:NEW.rec_appl_tests_id;
    END IF;
    commit;
    END;
    Thanks in advance,
    Palyou are creating triger on the table and updating it. It will not allow to update since you are firing trigger on same table.
    Best practice is to use other table to update or any other operation.

Maybe you are looking for

  • How to put a back button

    hi all i'm using jdev 10g 10.1.3. i'm tring to put a back button in my pages that when i click on it will go back to the page from which it came but am getting lost how to go about it. I created a backing bean with the following code for the Action p

  • User, Role, Profile Synchronization Job Fails

    Hi Gurus, When I am scheduling a job the User, Role, and Profile Sync. job fails giving an error "Cannot assign a java.lang.String object of length 53 to host variable 5 which has JDBC type VARCHAR(40)." This happens when the synchronization happens

  • Can receive, not send using Mail

    I haven't been able to send emails from Mail on my iMac (Mac OS X) since Feb. 5. I can receive, but I can only send them remotely. I haven't changed anything in my settings, signature...etc. All of the updates have been performed. The strange part is

  • How to write this java code in jsp using jstl  tags?

    Can anybody help me on this? I dont know how to check the containsKey using jstl tags? <%      LinkedHashMap yearMap     =     (LinkedHashMap)request.getAttribute("yearMap");      TreeSet nocSet               =     (TreeSet)request.getAttribute("nocS

  • Link width and heigth ?????

    someone tell me what is it please explain Link and width ???