Trigger error

hi barbara
i had dought
i created a simple trigger.But when i am inserting the records
in the specific table this trigger is not firing or inserting the records
what may be the error is it my simple mistake.how to write more good way
with regards
ramya
CREATE OR REPLACE TRIGGER BD_EXOS_insert_entl_hr_update
AFTER INSERT or update OF EE_EMPNO ON EE
FOR EACH ROW
BEGIN
insert into ele_fin(ele_fin_empno,ele_fin_year,ele_fin_entitlement)
select empno,'2004',0 from hr_update
WHERE EMPNO =:NEW.EE_EMPNO;
insert into hr_update(empno,name,dp,sec,title,grade,nation,doj)
select ee_empno,substr(ee_sname,1,25),ee_dept,ee_division,ee_telephone_no,
ee_job_grade,ee_supervisor,ee_stdate
from ee
where ee_empno=:NEW.EE_EMPNO;
END;

You cannot select from the same table that the trigger is on, from within the trigger. So, since the trigger is on table ee, then you cannot select from ee within the trigger. However, if the values of ee_empno are unique, so that there is only one row such that ee_empno = :new.ee_empno, then you can just use all of the :new values for that row for your insert into hr_update, instead of selecting from the ee table. Please see the corrected code below.
CREATE OR REPLACE TRIGGER BD_EXOS_insert_entl_hr_update
  AFTER INSERT or update OF EE_EMPNO ON EE
  FOR EACH ROW
BEGIN
  insert into ele_fin
    (ele_fin_empno, ele_fin_year, ele_fin_entitlement)
  select empno, '2004', 0
  from   hr_update
  WHERE  EMPNO = :NEW.EE_EMPNO;
  insert into hr_update
    (empno, name, dp, sec, title, grade, nation, doj)
  values (:NEW.ee_empno, substr (:NEW.ee_sname, 1, 25), :NEW.ee_dept,
          :NEW.ee_division, :NEW.ee_telephone_no, :NEW.ee_job_grade,
          :NEW.ee_supervisor, :NEW.ee_stdate);
END BD_EXOS_insert_entl_hr_update;

Similar Messages

  • IMAQ AVI Read Frame Trigger Error

    I have an application that is creating avi clips of a process.  This application is writing frame data which is read later in another application.  It is at this point, during the reading of the data that an Error -1074396037 Trigger error is occuring.  I am using IMAQ Vision 7.0 and Labview 7.0.  Attached is an avi that was created. It consists of a total of 75 frames.  Also attached is a simplified version of the frame read part of my application.  When reading the frame data I get the error at frames 36 and 51.
    I was hoping somebody could have a look and see why I am getting the error.
    Terry Sopkow
    Sr. Reseach Technologist
    Oilphase-DBR
    Attachments:
    ReadFrame.zip ‏596 KB

    Hi Terry,
    I ran your program with your video and got error 1074395975 DirectX has timed out reading the avi file.  I do not think there is anything wrong with your program because I ran your program with a different avi file and it worked perfectly.  I also ran the shipping example Read AVI Example.vi with your video and got the same timeout error.
    So there must be something wrong with your avi file.  Perhaps frames 36 and 51 are missing or corrupt for some reason.  Try creating the avi file again and see if you still have the same problem.  If you do, then we'll have to investigate the problem with the creation of the file.
    Christopher W.
    Application Engineer
    National Instruments

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

  • PRE-DELETE TRIGGER ERROR

    I am debugging a program written by Developer/2000 forms 4.5
    I use 3 to 4 base tables and they all have parent/child relatioship.
    When i try to delete one of them , the error is : pre-delete trigger error.
    any idea ?

    Hi, Lesley
    Beware:
    your form_success test is not working.
    The form_success, form_failure and form_fatal functions should only be used to test the outcome of Forms Built-ins.
    If you want to test the result of DELETE statements, try:
    DELETE FROM TABLE
    WHERE CONDITION;
    IF SQL%FOUND THEN
    MESSAGE('Some rows were deleted');
    ELSE
    MESSAGE('No rows were deleted');
    END IF;You can also use SQL%ROWCOUNT to know how many rows were deleted.
    Hope this helps,

  • Global temp table trigger error on Oracle AS

    we have a set of triggers that load a temp table in the before delete,update and process the table in an after statement trigger. the data that's loaded is a complaintid and when the complaintid is selected into a variable in the after statement, a No data found error is fired. This only happens on Oracle AS both 9i and 10g, it does not happen on jboss. All the app servers use connection pooling and they are 9i Enterprise Edition Dedicated database servers.
    Is it possible that there is a bug in Oracle AS that allows multiple sessions to affect the same global variables ?
    Sorry it's a long one, but I wanted to include everything I could
    table creation script.
    CREATE GLOBAL TEMPORARY TABLE TEMPEVENTS
    (     COMPLAINTID VARCHAR2(20) NOT NULL ENABLE,
         COMPLAINTEVENTID NUMBER NOT NULL ENABLE,
         STARTDATE DATE,
         EVENTTYPE NUMBER,
         EVENTSUBTYPE NUMBER,
         DELETED NUMBER
    ) ON COMMIT DELETE ROWS
    Before update trigger-- as a test I saved the data in a permanent table and all columns have usable values.
    create or replace trigger BeforeUpdateReportDataROW
    BEFORE Delete or Update of deleted, startdate on complaintevents
    FOR EACH ROW
    BEGIN
    IF (DELETING AND :old.deleted = 0) OR (UPDATING AND :new.deleted=1 AND :old.startDate = :new.startDate) THEN
         TEMPDATA.v_triggerType := 'D';
    ELSIF UPDATING AND :old.deleted=1 AND :old.startDate = :new.startDate THEN /*undeleting*/
         TEMPDATA.v_triggerType := 'U';
    ELSIF UPDATING AND :old.startDate != :new.startDate THEN /*new date*/
         TEMPDATA.v_triggerType := 'S';
    ELSE
         TEMPDATA.v_triggerType := 'N';
    END IF;
    TEMPDATA.v_NumEntries := TEMPDATA.v_NumEntries + 1;
    TEMPDATA.v_complaintids(TEMPDATA.v_NumEntries) := :old.complaintid;
    TEMPDATA.v_complainteventids(TEMPDATA.v_NumEntries) := :old.complainteventid;
    END;
    After statement trigger -- the error happens on the
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    statement. this is all one transaction the complaintid is loaded from the complaintevent table, and is not a primary key, nor is there only one record in the complaintevent table for each complaintid.
    create or replace trigger complaintevents_del_upd_trig
    AFTER DELETE OR UPDATE OF deleted, startdate
    ON complaintevents
    DECLARE
    complaintid VARCHAR2 (20);
    loop_index NUMBER;
    hold_complaintid VARCHAR2 (20);
    BEGIN
    IF tempdata.v_triggertype = 'D'
    THEN /*deleting event*/
    hold_complaintid := ' ';
    FOR loop_index IN 1 .. tempdata.v_numentries
    LOOP
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    IF hold_complaintid != complaintid
    THEN
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index);
    END IF;
    DELETE tempevents
    WHERE complainteventid =
    tempdata.v_complainteventids (loop_index)
    OR deleted = 1;
    hold_complaintid := complaintid;
    END LOOP;
    ELSIF tempdata.v_triggertype = 'U'
    THEN /*undeleting*/
    hold_complaintid := ' ';
    FOR loop_index IN 1 .. tempdata.v_numentries
    LOOP
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    IF hold_complaintid != complaintid
    THEN
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index);
    END IF;
    DELETE tempevents
    WHERE deleted = 1;
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, 0
    FROM complaintevents
    WHERE complainteventid =
    tempdata.v_complainteventids (loop_index);
    hold_complaintid := complaintid;
    END LOOP;
    ELSIF tempdata.v_triggertype = 'S'
    THEN /*date change*/
    hold_complaintid := ' ';
    FOR loop_index IN 1 .. tempdata.v_numentries
    LOOP
    SELECT complaintid
    INTO complaintid
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index)
    AND complainteventid = tempdata.v_complainteventids (loop_index);
    IF hold_complaintid != complaintid
    THEN
    INSERT INTO tempevents
    (complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted)
    SELECT complaintid, complainteventid, startdate, eventtype,
    eventsubtype, deleted
    FROM complaintevents
    WHERE complaintid = tempdata.v_complaintids (loop_index);
    END IF;
    DELETE tempevents
    WHERE deleted = 1;
    hold_complaintid := complaintid;
    END LOOP;
    ELSE
    RETURN;
    END IF;
    END;

    CREATE GLOBAL TEMPORARY TABLE test_glb ON COMMIT DELETE ROWS
    AS SELECT * FROM test1;btw I'm assuming you are just using the SELECT statement to copy the definition of test1. Since DDL statements commit, there will be no rows in test_glb after creating it.
    Edited by: William Robertson on Feb 23, 2009 7:31 AM

  • How can i creat a trigger    error  invalid trigger specification

    i have a stored procedure which i want it to be triggered when an insertion is done on table A
    and that stored procedure accepts values from the insertion performed in table A
    and inserts into Table B by either updating the table or insertion into Table B
    how can i achieve this
    OK fine i have a table called Table A
    i want a trigger that can accept values such as
    create or replace trigger UpdateMyDoc  after insert on  Table A
    for each row
    accoutntno varchar2,
    ID varchar2
    As
    cnt number;
    Begin
    update Table B value (accoutntno ,ID ); commit;
    end ;
    is the above possible if it is then i get this  [1]: (Error): ORA-04079: invalid trigger specification
    any help
    Edited by: kama021 on Aug 13, 2009 2:24 AM

    Stop right there, Kama.
    update Table B value (accoutntno ,ID ); commit;Do not go any further on triggers, until you at least know how to write an UPDATE
    Or is it INSERT
    Once you have that in place, carry on by reading a bit about Transactions
    Regards
    Peter

  • How to trigger error message

    We are using the following sceanrio:
    R/3 Idoc > IDoc Adapter > XI > JDBC Adapter > SQL databse
    and reverse.
    we want to trigger some error messages enroute.
    But we are not able to finalize the points where we can anticipate for errors, how to catch thema dn report.
    Is there any documentation out there that can help us to proceed with our sceanrio?
    Thanks,
    Bhaskar

    closing - no answer

  • How to trigger error message in PCUI when a BADI is called in SAP Backend

    Hi,
    I am currently coding some validations in the implementation of BADI, CRM_CUSTOMER_I_BADI.
    I know that PCUI will trigger the interface methods, CRM_CUSTOMER_I_CHECK and CRM_CUSTOMER_I_MERGE.
    So is there any way I can deliver status or warning or error message to the users in PCUI, by coding in the above 2 methods?? If yes, how do I do it or if anyone has any sample codes, I will appreciate it very much.
    Thanks.

    Hi,
    i think you should post a link to this question in the  <a href="https://forums.sdn.sap.com/forum.jspa?forumID=126">CRM Development Forum</a> here in SDN.
    Regards
    Gregor

  • Show a insert trigger error message on a compiled form

    Good Morning
    Is there any way to get a oracle complied form to display a message
    from a trigger insert event.
    My problem is that we have proprietry oracle froms application (with compiled
    forms and no source code. I need to raise some sort of warning message
    from the form when certain condition occurs.
    I have tried using some code like below in the trigger
    but the dbms_output.put_line does not output anything
    nor the EXCEPTION
    DECLARE MY_ERROR exception;
    begin
    DBMS_OUTPUT.ENABLE;
    dbms_output.put_line('outputting this message');
    raise MY_ERROR;
    EXCEPTION
    WHEN others THEN Raise;
    END;
    thanks
    David Hills

    You don't need to get at the source code of the form. The example you gave will stop the execution of any process and you said it should happen for an insert event. So a Raise_Application_Error in a database trigger would be sufficient.
    Hopefully the vendor has put code in their on-error triggers which will cut the message out of a user-defined exception and display it as an alert (this is so much a better method than returning numbers to indicate success or type of failure). If not then the message will be rather ugly but it will at least get the job done.
    James.

  • How to show a database trigger error message as a notification on a page

    I have a database with database triggers to ensure data integrity.
    If an insert or update does not comply to all the business rules, a database triggers raises an exception. When using Apex this exception is caught in the Error Screen, a separate screen, where the whole error stack is displayed.
    Does anyone know a way to display only the error in RAISE_APPLICATION_ERROR as a notification in the screen from which the transaction was initiated?
    Dik Dral

    Well, having had so little response, i had to figure it out myself ;-)
    Using Patrick Wolff's ideas from ApexLib I 'invented' a solution for my problem, that I would like to contribute to the community. I hope that it will come out a bit nicely formatted:
    Apex: Show Database Error Message in calling form
    The purpose is to show a neat error message in the notification area of the calling form.
    Default Apex show the whole error stack raised by a DB trigger in a separate error page.
    With acknowledgement to Patrick Wolf, I lent parts of his ApexLIB code to create this solution.
    <br./>
    Assumptions
    <ul><li>The error message is raised from a DB trigger using RAISE_APPLICATION_ERROR(-20000,’errormessagetext’).</li>
    <li>The relevant part of the error stack is contained within the strings ‘ORA-20000’ and the next ‘ORA-‘-string, i.e. if the error stack is ‘ORA-20000 Value should not be null ORA-6502 …’, than the relevant string is ‘Value should not be null’ .</li>
    <li>Cookies are enabled on the browser of the user </li>
    </ul>
    Explanation
    The solution relies heavily on the use of Javascript. On the template of the error page Javascript is added to identify the error stack and to extract the relevant error message. This message is written to a cookie, and then the control is passed back to the calling page (equal to pushing the Back button).
    In the calling page a Javascript onLoad process is added. This process determines whether an error message has been written to a cookie. If so the error message is formatted as an error and written to the notification area.
    Implementation
    The solution redefines two template pages, the two level tab (default page template) and the one level tab (error page template).
    Javascript is added to implement the solution. This Javascript is contained in a small library errorHandling.js:
    <pre>
    var vIndicator = "ApexErrorStack=";
    function writeMessage(vMessage)
    {       document.cookie = vIndicator+vMessage+';';
    function readMessage()
    { var vCookieList = document.cookie;
    var vErrorStack = null;
    var vStart = null;
    var vEnd = null;
    var vPos = null;
    vPos = vCookieList.indexOf(vIndicator);
    // No cookie found?
    if (vPos == -1) return("empty");
    vStart = vPos + vIndicator.length;
    vEnd = vCookieList.indexOf(";", vStart);
    if (vEnd == -1) vEnd = vCookieList.length;
    vErrorStack = vCookieList.substring(vStart, vEnd);
    vErrorStack = decodeURIComponent(vErrorStack);
    // remove the cookie
    document.cookie = vIndicator+"; max-age=0";
    return(vErrorStack);
    function getElementsByClass2(searchClass,node,tag)
    var classElements = new Array();
    if ( node == null )
    node = document;
    if ( tag == null )
    tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = newRegExp('(^|\\s)'+searchClass+'(\\s|$)');
    for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els.className) ) {
    classElements[j] = els[i];
    j++;
    return classElements;
    function processErrorText()
    var errorElements = new Array();
    errorElements = getElementsByClass2("ErrorPageMessage",document,"div");
    if (errorElements.length > 0 )
    { errorText = errorElements[0].innerHTML;
    errorText = errorText.substr(errorText.indexOf("ORA-20000")+ 11);
    errorText = errorText.substr(0,errorText.indexOf("ORA")-1);
    // errorElements[0].innerHTML = errorText;
    writeMessage(errorText);
    function show_message()
    { var vCookieList = document.cookie;
    var vErrorStack = null;
    var vErrorName = null;
    var vErrorMessage = null;
    var vStart = null;
    var vEnd = null;
    var vPos = null;
    // get errorStack
    vErrorStack = readMessage();
    if (vErrorStack == -1) return;
    // search for our message section (eg. t7Messages)
    var notificationArea = document.getElementById("notification");
    if (notificationArea != null)
    { notificationArea.innerHTML = '<div class="t12notification">1 error has occurred<ul class="htmldbUlErr"><li>' + vErrorStack + '</li></ul>'; }
    else
    { alert(vErrorStack); }
    </pre>
    This code is loaded as a static file in Application Express (no application associated).
    In both templates a reference to this code is added in the Definition Header section:
    <pre>
    <script src="#WORKSPACE_IMAGES#errorHandling.js" type="text/javascript"></script>
    </pre>
    This library is called from the two level tab to show the error message (if any) in het onLoad event of the body tag.
    <body onLoad="javascript:show_message();">#FORM_OPEN#
    This code checks whether a message has been written to a cookie and if found displays the message in the notification area.
    In the error template page the Error section has the content:
    <script language="javascript">
    processErrorText();
    window.history.go(-1);
    </script>
    Back
    The call to processErrorText() looks for the error message, extracts the relevant part of it (between ‘ORA-20000’ and the next ‘ORA-‘), writes it to a cookie and returns to the previous screen.
    The link to the previous page is added should an error in the Javascript occur. It provides the user with a path back to the application.
    With these actions taken, the error messages issued from triggers are shown in the notification area of the form the user has entered his data in.
    The need for database driven messaging
    In some cases the need exists to process error messages in the database before presenting them to the user. This is the case, when the triggers return message codes, associated to error messages in a message table.
    This can be done by using a special Error Message Processing page in Apex.
    The error message page extracts the error message, redirecting to the Error Message Processing page with the error message as a parameter. In the EMP page a PL/SQL function can be called with the message as a parameter. This function returns the right message, which is written to a cookie using dynamically generated Javascript from PL/SQL. Than the contol is given back to the calling form.
    The redirect is implemented by location.replace, so that the error message page does not exist within the browsing history. The normal history(-1) will return to the calling page.
    Implementation of database driven messaging
    The solution redefines two template pages, the two level tab (default page template) and the one level tab (error page template).
    Javascript is added to implement the solution. This Javascript is contained in a small library errorHandling.js already listed in a previous paragraph.
    In both templates a reference to this code is added in the Definition Header section:
    <script src="#WORKSPACE_IMAGES#errorHandling.js" type="text/javascript"></script>
    This library is called from the two level tab to show the error message (if any) in het onLoad event of the body tag.
    <body onLoad="javascript:show_message();">#FORM_OPEN#
    This code checks whether a message has been written to a cookie and if found displays the message in the notification area.
    In the error template page the Error section has the content:
    <script language="Javascript">
    var errorText = null;
    function redirect2oracle()
    { window.location.replace("f?p=&APP_ID:500:&APP_SESSION.::::P500_MESSAGE:"+errorText); }
    function getError()
    { errorText = processErrorText(); }
    getError();
    redirect2oracle();
    </script>
    Go to Error Message Porcessing Page
    Back to form
    The call to processErrorText() looks for the error message, extracts the relevant part of it (between ‘ORA-20000’ and the next ‘ORA-‘), writes it to a cookie.
    Then the EPM-page (500) is called with the extracted message as parameter.
    The link to the EPM page and the previous page is added should an error in the Javascript occur. It provides the user with a path back to the application.
    We need to create an Error Message Porcessing Page.
    Create a new page 500 with a empty HTML-region “Parameters”
    Create an text-area P500_MESSAGE in this region
    Create a PL/SQL region “Process Messages” with source:
    convert_message(:P500_MESSAGE);
    Create a PL/SQL procedure convert_message like this example, that reads messages from a message table. If not found, the actual input message is returned.
    CREATE OR REPLACE procedure convert_message(i_message in varchar2) is
    v_id number := null;
    v_message varchar2(4000) := null;
    function get_message (i_message in varchar2) return varchar2 is
    v_return varchar2(4000) := null;
    begin
    select msg_text into v_return
    from messages
    where msg_code = upper(i_message);
    return(v_return);
    exception
    when no_data_found then
    return(i_message);
    end;
    begin
    v_message := get_message(i_message);
    // write the message for logging/debugging
    htp.p('Boodschap='||v_message);
    // write cookie and redirect to calling page
    htp.p('<script language="Javascript">');
    htp.p('document.cookie="ApexErrorStack='||v_message||';";');
    htp.p('window.history.go(-1);');
    htp.p('</script>');
    // enter return link just in case
    htp.p('Ga terug');
    end;
    Note: The way the message is converted is just an example
    With these actions taken, the error messages issued from triggers are shown in the notification area of the form the user has entered his data in.
    Message was edited by:
    dickdral
    null

  • Instead of Trigger Error

    Hi ALL,
    I am trying to create INSTEAD OF trigger on the existing VIEW, but I getting error as:-
    Not found
    The requested URL /apex/wwv_flow.show was not found on this server
    I'm creating trigger as :-
    CREATE OR REPLACE TRIGGER "trigger_name"
    INSTEAD OF UPDATE ON "view_name"
    FOR EACH ROW
    BEGIN
    UPDATE query;
    UPDATE query;
    END;
    but when I'm writting only one update query rather two update queires in the above trigger, it is creating but not with two update queries.
    Also I created another INSTEAD OF trigger on the same View as:-
    CREATE OR REPLACE TRIGGER "trigger_name"
    INSTEAD OF INSERT ON "view_name"
    FOR EACH ROW
    BEGIN
    INSERT query;
    INSERT query;
    END;
    this trigger is created without any errors than why INSTEAD OF(FOR UPDATE) trigger is not creating.... can anybody help me out with this issue.....
    thxs
    regards,
    Kumar

    Hi again,
    everything is working very much fine(I mean instead of trigger with update as well as with insert) when I'm creating on apex workspace.... this is the issue with my development enviornment.... so this is the problem with development DB or something else?????
    thxs
    regards,
    Kumar

  • Displaying a trigger error in forms

    In a before inserting table trigger, if inserted values are not correct, I raise an error :
    RAISE_APPLICATION_ERROR(-20001,'Error message !');
    What I want is to display this error message in forms instead of the error 40508 - ORACLE error: unable to INSERT record.
    How can I ?

    look at Dbms_Error_Code and Dbms_Error_Text.
    You'll have to parse them, but you can grab the error messages off them.
    Here's a similar question I asked on Metalink... I never received an error there, but the solution was to write an on-error trigger for the block and capture the form errors related to inserts, updates, and deletes. Here's the question though:
    Oracle Forms/Web Forms Technical Forum
    From: ERIC GIVLER 18-Nov-00 15:16
    Subject: "Clean" capture of DBMS Error messages on raise_application_error
    "Clean" capture of DBMS Error messages on raise_application_error
    This is with Forms 4.5 Developer 1.3.2 (32bit)
    Has anyone written forms level triggers, I guess ON-ERROR triggers to properly capture the error messages raised from a database trigger or procedure that uses a RAISE_APPLICATION_ERROR?
    I'd like to display the SAME message that I'm passing to RAISE application error, the message only, without all the other garbage.
    I was thinking of capturing the dbms_error_code and dbms_error_text, and then based on the form error code - kind of like in the example code in the Forms Help. Then, I'd parse these strings and strip off my error message, because the dbms_error_text contains the entire "error stack", ie:
    ORA-20100: SEASON DATES ERROR! Reservations exist in this date range
    ORA-06512: at "SUNTRACK.SEASON_DATES_BR_D", line 19
    ORA-04088: error during execution of trigger 'SUNTRACK.SEASON_DATES_BR_D'
    So... I'd like to just get "SEASON DATES ERROR! Reservations exist in this date range" message
    Questions:
    1. Is there an easy way to do this that I'm missing, or do I have to brute force, look for 'ORA'&#0124; &#0124;dbms_error_code&#0124; &#0124;': ' in my dbms_error_text, strip that off the front, and then grab the error text up to the first LINEFEED, chr(10), found in the dbms_error_text - that just seems a little "kludgy"
    2. Anyone have a nice solution? IT seems like there should be a "standard" on-error trigger that handles this type of situation.
    3. What would be all the form errors that I should look for that could have been the result of an error raised in a trigger???
    ie. frm-40509 (unable to update), frm-40510 (unable to delete
    null

  • Instead of Update Trigger error

    Hi all,
    I've been trying to solve this issue from past 4 to 5 days..I am unable to solve...Can someone please help....
    I hhave a requirement in which I need to update 4 tables from a single form...I created a view which will get the required fields along with the primary keys from all these 4 tables.
    Then I created a Instead of Update trigger as below
    CREATE OR REPLACE TRIGGER "HOMEPAGEVIEW_UPDATE"
    INSTEAD OF UPDATE ON cts_homepageview
    BEGIN
    DECLARE
    vID NUMBER;
    UPDATE cts_hardware_info
    SET STATUS_ID = :NEW.STATUS_ID,
    COMPUTER_NAME = :NEW.COMPUTER_NAME,
    OPERATINGSYSTEM_ID = :NEW.OPERATINGSYSTEM_ID
    where computer_id = :NEW.COMPUTER_ID;
    UPDATE cts_server_administrator
    SET PRIMARY_ADMIN_ID = :NEW.PRIMADMIN_ID,
    SECONDARY_ADMIN_ID = :NEW.SECONDADMIN_ID
    WHERE ID = :NEW.ID;
    UPDATE cts_location_info
    SET BUILDING_ROOM_RACK = :NEW.BUILDING_ROOM_RACK
    WHERE LOCATION_ID = :NEW.LOCATION_ID;
    UPDATE cts_maintenace_info
    SET MAINTENANCE_WINDOW = :NEW.MAINTENANCE_WINDOW
    WHERE MAINTENANCE_ID = :NEW.MAINTENANCE_ID;
    END;
    When I try to update a record, am gettting the following error
    ORA-20505: Error in DML: p_rowid=488, p_alt_rowid=COMPUTER_ID, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
    Error Unable to process row of table CTS_HOMEPAGEVIEW.
    OK
    I have already posted this question on the forum, but dint get any replies so trying my luck again....Can someone plzzzzzz help...I searched on ths forum for similar requests...Found one post bt hte solution wasnt given...
    Thanks,
    Shravanthi
    Edited by: user0012 on Apr 29, 2009 9:54 AM

    Hi Varad and Andy,
    Thank you both for your responses first..I was soo tensed since no one replied to my previous post fr 5 days..
    Varad,
    With the change Andy told ('Begin & END'), I tried in SQL Workshop updated computer_name (of cts_hardware_info) data in the view..It updated the data. But from the form, it is still giving the same error.
    Andy,
    Here is my view.. All the table are associated with the cts_hardware_info using computer_id. And using this computer_id I have put all the data together.
    CREATE OR REPLACE FORCE VIEW "CTS_HOMEPAGEVIEW" ("COMPUTER_ID", "COMPUTER_NAME", "STATUS_ID", "DESCRIPTION", "OPERATINGSYSTEM_ID", "ID", "PRIMADMIN_ID", "PRIMARYADMIN_PHONE1", "SECONDADMIN_ID", "SECONDARYADMIN_PHONE1", "LOCATION_ID", "BUILDING_ROOM_RACK", "MAINTENANCE_ID", "MAINTENANCE_WINDOW") AS
    select g.computer_id,g.computer_name,g.status_id,cts_hardware_status.DESCRIPTION,g.operatingsystem_id,g.id,g.PrimAdmin_ID,g.PrimaryAdmin_Phone1,g.SecondAdmin_ID, g.SecondaryAdmin_PHONE1,g.location_id,g.BUILDING_ROOM_RACK,g.MAINTENANCE_ID,g.MAINTENANCE_WINDOW from
    (select e.computer_id,e.computer_name,e.status_id,e.operatingsystem_id,e.id,e.PrimAdmin_ID,e.PrimaryAdmin_Phone1,e.SecondAdmin_ID,e.SecondaryAdmin_PHONE1,
    e.location_id,e.BUILDING_ROOM_RACK,f.MAINTENANCE_ID,f.MAINTENANCE_WINDOW from
    (select c.computer_id,c.computer_name,c.status_id,c.operatingsystem_id,c.id,c.PrimAdmin_ID,c.PrimaryAdmin_Phone1,c.SecondAdmin_ID,c.SecondaryAdmin_PHONE1,
    d.location_id,d.BUILDING_ROOM_RACK from
    (select a.computer_id,a.computer_name,a.status_id,a.operatingsystem_id,b.id,b.PrimAdmin_ID,b.PrimaryAdmin_Phone1,b.SecondAdmin_ID,b.SecondaryAdmin_PHONE1 from
    (select cts_hardware_info.computer_id,cts_hardware_info.computer_name,cts_hardware_info.status_id,operatingsystem_id from cts_hardware_info) a
    left join
    (select cts_server_administrator.id,cts_server_administrator.computer_id,cts_administrator_contacts.ADMIN_id as PrimAdmin_ID,Phone1 as PrimaryAdmin_Phone1,
    (select ADMIN_id from cts_administrator_contacts where admin_id = CTS_Server_Administrator.Secondary_ADMIN_ID) as SecondAdmin_ID,
    (select Phone1 from cts_administrator_contacts where admin_id = CTS_Server_Administrator.Secondary_ADMIN_ID) as SecondaryAdmin_PHONE1
    from cts_server_administrator,cts_administrator_contacts where cts_administrator_contacts.admin_id = cts_server_administrator.PRIMARY_ADMIN_ID) b
    on a.computer_id = b.computer_id) c
    left join
    (select location_id,COMPUTER_ID,BUILDING_ROOM_RACK from cts_location_info) d
    on c.computer_id = d.computer_id) e
    left join
    (select MAINTENANCE_ID,COMPUTER_ID,MAINTENANCE_WINDOW from CTS_MAINTENACE_INFO) f
    on e.computer_id = f.computer_id) g left join cts_hardware_status on g.status_id = cts_hardware_status.STATUS_ID

  • Update trigger error

    Hello,
    I have this issue where I'm getting the following error when executing an update in a view. Insert command appears to be OK. Any idea on what am I missing?
    ORA-01084: invalid argument in OCI call
    ORA-06512: at "APPS.XXRVM_TEMP_B_UPD_TR", line 2
    ORA-04088: error during execution of trigger 'APPS.XXRVM_TEMP_B_UPD_TR'
    -- sample update statement:
    update xxrvm_temp_b_v
    set text1 = 'ddd'
    where text1 = 'aaa'
    Thanks,
    Rownald
    ----- object definitions ----
    -- Located in TEST1 Dbase
    create table xxrvm_temp_b
    (text1 varchar2(30)
    ,text2 varchar2(30)
    -- Located in TEST2 Dbase
    -- view definition based on table at dblink
    create or replace force view xxrvm_temp_b_v
    (pri_key, text1, text2) as select rowid pri_key, text1, text2 from xxrvm_temp_b@test1;
    -- trigger definition for insert
    create or replace trigger xxrvm_temp_b_ins_tr
    instead of insert on xxrvm_temp_b_v referencing new as new old as old
    for each row
    begin
    insert into xxrvm_temp_b@test1 (text1, text2)
    values (:new.text1, :new.text2);
    end;
    -- trigger definition for update
    create or replace trigger xxrvm_temp_b_upd_tr
    instead of update on xxrvm_temp_b_v referencing new as new old as old
    for each row
    begin
    update xxrvm_temp_b@test1
    set text1 = :new.text1 ,text2 = :new.text2
    where rowid = :new.pri_key;
    end;

    Hello:
    Check if the update works if you re-write the on-update trigger as-- trigger definition for update
    create or replace trigger xxrvm_temp_b_upd_tr
    instead of update on xxrvm_temp_b_v referencing new as new old as old
    for each row
    begin
    update xxrvm_temp_b@test1
    set text1 = :new.text1 ,text2 = :new.text2
    where text1=:old_text1 and text2=:old_text2
    end;Varad

  • TRIGGER ERROR: bad bind variable

    Hello,
    I'm just starting off with oracle and am trying to do the same as auto_increment in mysql is doing by creating this sequence and trigger, but on the trigger I am getting the following error:
    error:
    PLS-00049: bad bind variable 'TAKEOVER_USERS.TAKEOVER_UID'This is the code for trigger, table and sequence:
    trigger:
    CREATE OR REPLACE TRIGGER  "TAKEOVER_USERS_T1"
    BEFORE
    insert on "TAKEOVER_USERS"
    for each row
    begin
    select TAKEOVER_UID.nextval into :takeover_users.TAKEOVER_UID from dual;
    end;Table:
    CREATE TABLE  "TAKEOVER_USERS"
       ( "TAKEOVER_UID" NUMBER NOT NULL ENABLE,
    "TAKEOVER_FBID" VARCHAR2(20) NOT NULL ENABLE,
    "takeover_accepted_terms" NUMBER(1,1) NOT NULL ENABLE,
    "takeover_lastName" VARCHAR2(30),
    "takeover_firstName" VARCHAR2(30),
    "takeover_country" VARCHAR2(40),
    "takeover_session" VARCHAR2(50) NOT NULL ENABLE,
    "takeover_created" TIMESTAMP (6) NOT NULL ENABLE,
      CONSTRAINT "takeover_users_PK" PRIMARY KEY ("TAKEOVER_UID") ENABLE
       )sequence:
    CREATE SEQUENCE   "TAKEOVER_UID"  MINVALUE 1 MAXVALUE 99999999999999 INCREMENT BY 1 START WITH 1 NOCACHE  NOORDER  NOCYCLEYou got any idea what I need to change to make this work?
    Thanks!
    Christine

    if your DB is 11g you can try this
    CREATE OR REPLACE TRIGGER  "TAKEOVER_USERS_T1"
    BEFORE
    insert on "TAKEOVER_USERS"
    for each row
    begin
    :NEW.TAKEOVER_UID:=TAKEOVER_UID.nextval;
    end;if 10g or older..
    CREATE OR REPLACE TRIGGER  "TAKEOVER_USERS_T1"
    BEFORE
    insert on "TAKEOVER_USERS"
    for each ROW
    BEGIN
    SELECT TAKEOVER_UID.NEXTVAL INTO :NEW.TAKEOVER_UID FROM dual;
    end;Regards,
    Prazy

Maybe you are looking for