Results 1 to 3 of 3

Thread: How to get RAISE_APPLICATION_ERROR message alone?

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Answers
    2

    How to get RAISE_APPLICATION_ERROR message alone?

    How to get RAISE_APPLICATION_ERROR message alone?

    I have a stored procedure in which I have defined an Exception:

    childFound EXCEPTION;

    and the exception block looks like this

    EXCEPTION
    WHEN childFound THEN
    RAISE_APPLICATION_ERROR(-20001,'DELETE CHILD FIRST');

    I would like to display just the message 'DELETE CHILD FIRST'. But when I try to get the message it displays as follows:

    ORA-20001: DELETE CHILD FIRST
    ORA-06512: at "QUALITY.PKG_QUALITY_CHECK_SUMMARY", line 445
    ORA-06512: at line 1

    Can someone help me with this?

    Cheers,
    Srini


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: How to get RAISE_APPLICATION_ERROR message alone?

    That is the nature of the sub routine. It will display error number with the error message.
    If you want only the error message not the number then use DBMS_OUTPUT.PUT_LINE instead of RAISE_APPLICATION_ERROR.


  3. #3
    Junior Member
    Join Date
    Jun 2009
    Answers
    1

    Re: How to get RAISE_APPLICATION_ERROR message alone?

    Actually, you can use the optional third parameter to do what you want:

    "To call RAISE_APPLICATION_ERROR, use the syntax

    raise_application_error(error_number, message[, {TRUE | FALSE}]);

    where error_number is a negative integer in the range -20000 .. -20999 and message is a character string up to 2048 bytes long. If the optional third parameter is TRUE, the error is placed on the stack of previous errors. If the parameter is FALSE (the default), the error replaces all previous errors. RAISE_APPLICATION_ERROR is part of package DBMS_STANDARD, and as with package STANDARD, you do not need to qualify references to it."

    So..try calling RAISE_APPLICATION_ERROR once with TRUE and once with FALSE as the third parameter and see if it does what you want...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact