Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2008
    Posts
    5

    Unanswered: How to catch a database trigger error in Forms

    What do I need to do if I can catch and display in a form an error message generated by a database trigger?

    Let´s suppose the following database trigger

    create or replace trigger trigger_bef_upd
    before update of myField on myTable
    for each row
    declare
    myException Exception;
    begin
    if :new.campo > 9 then raise myException ;
    end if;
    exception
    when myException then
    raise_application_error(-20999,Invalid value, you cannot update this field', TRUE);
    end;


    I would like to display the error message as it has been raised by the trigger

    Thanks in advance!!!!

  2. #2
    Join Date
    Dec 2008
    Posts
    5
    Quote Originally Posted by sergioesp
    What do I need to do if I can catch and display in a form an error message generated by a database trigger?

    Let´s suppose the following database trigger

    create or replace trigger trigger_bef_upd
    before update of myField on myTable
    for each row
    declare
    myException Exception;
    begin
    if :new.campo > 9 then raise myException ;
    end if;
    exception
    when myException then
    raise_application_error(-20999,Invalid value, you cannot update this field', TRUE);
    end;


    I would like to display the error message as it has been raised by the trigger

    Thanks in advance!!!!

    This is the correct version of the trigger

    create or replace trigger trigger_bef_upd
    before update of myField on myTable for each row
    declare
    myException Exception;
    begin
    if :new.myField > 9 then raise myException;
    end if;
    exception
    when myException then
    raise_application_error(-20999,'Invalid value, you cannot update this field');
    end;

  3. #3
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    See the form trigger "ON-ERROR"
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •