Results 1 to 6 of 6
  1. #1
    Join Date
    May 2007
    Posts
    8

    Unanswered: Raise_application_error drop the error number when displaying

    Hi,

    I'm raising an error from the dB to an Application like theis RAISE_APPLICATION_ERROR(-20000, 'Contact Support');
    the thing is the error printed on screen contains the -20000, is there any way to use this exception and drop the 20000 bit... i've tried user defined and dbms_ouput but neither are captured by the app

    any ideas

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    What tool did you use to create your application? Mentioning the DBMS_OUTPUT package, I can only suspect that you use it from a command line mode. If not, is it Forms Developer that you used? Something else?

  3. #3
    Join Date
    May 2007
    Posts
    8
    I use TOAD to dev the db and Forms for the app, FORMS only displays the RAISE_APPLIACATION_ERROR for me which is fine if I can drop that unslightly error number aka 20000

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    I didn't understand what raises the error. Is it a database trigger on the table (a BEFORE INSERT one, perhaps)? If so, how does it look like? Something like this?
    Code:
    CREATE OR REPLACE TRIGGER trg_test
      BEFORE INSERT ON TEST
      FOR EACH ROW
    BEGIN
      RAISE_APPLICATION_ERROR(-20000, 'Contact Support') ;
    END;
    What you did next was writing a form; assume that it is a simple, default form, written using the Data Block Wizard. When you try to insert a record (save it, actually), you get a message (in the bottom line of the form) saying "FRM-40508: ORACLE error: unable to INSERT record". Now, selecting Help - Display Error reveals what caused it, and now it says "ORA-20000: Contact Support" etc.

    What I didn't understand was the way you managed to display ORA-20000 without those additional steps. Did you write a form trigger? Which one? How does it look like? Could you post some extra info (perhaps even a screenshot of the form error)?

  5. #5
    Join Date
    May 2007
    Posts
    8
    HI,
    I have an error checking function in my dB, that contains the RAISE_APPLICATION_ERROR and in Forms I have the following type code that on button clicked checks for erros in this function first and then displays them.

    FORMS -
    if Function(error) then
    x_message(error ');
    raise FORM_TRIGGER_FAILURE;
    end if;

    dB - RAISE_APPLICATION_ERROR

  6. #6
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Could you simply use a SUBSTRING of an error message? I believe it has a fixed format, such as "ORA-20000: Contact Support", so in this case you'd display

    SUBSTR(error_message, 12, LENGTH(error_message))

Posting Permissions

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