3 Replies Latest reply: Sep 19, 2013 7:06 PM by PPlatt RSS

    How to insert new line character in raise_application_error text in PLSQL process?

    PPlatt

      Hi,

      I have a raise_application_error message in my PLSQL code that displays in the notification area of the APEX page when raised.  I would like to place a carrage return at specific points in the message.  I've tried both chr(10) concatenations and  adding '<br>' . Neither works.  Any suggestions?  It seems that the notification formating strips out HTML.

      thanks in advance

      PaulP

        • 1. Re: How to insert new line character in raise_application_error text in PLSQL process?
          vdsadhi

          Hi Paul,

           

          I think chr(10) and <br> won't work in this case because i tried in my app. We can try some other way for this, error msg used <li> under <ul> tag in notification. so we can try to append one more <li> tag with the msg under <ul>. I tried it in my app and it works, I just placed the below code in page html header,

          <script>

          $(document).ready(function(){

              $(".htmldbUlErr").append("<li>Your Message</li>");

            });

          </script>

          htmldbUlErr is class of <ul> tag.


          but it will append your msg in all notification if you have some other validation on your page.


          If possible try to use APEX_ERROR package and it's procedures for error handling. Please check the below link,


          APEX_ERROR



          Thanks

          Lakshmi



          • 2. Re: How to insert new line character in raise_application_error text in PLSQL process?
            fac586

            PPlatt wrote:

             

            I have a raise_application_error message in my PLSQL code that displays in the notification area of the APEX page when raised.  I would like to place a carrage return at specific points in the message.  I've tried both chr(10) concatenations and  adding '<br>' . Neither works.  Any suggestions?  It seems that the notification formating strips out HTML.

            Not surprised that line feeds don't work (though it's probably possible using CSS white-space: pre-line). In what way does br not work? (And what APEX version are you using?)

             

            However, I doubt that white space or forced line breaks are the correct way to mark this up (unless the error messages are haiku). As mentioned above, lists are the correct way to do this. I have previously created multi-level validation error messages using nested lists in an APEX 3.0 app using (IIRC) the function returning error text option. I suggest you provide more information on the nature of the messages, and where and how the error is raised. preferably in the form of an example on apex.oracle.com.

            • 3. Re: How to insert new line character in raise_application_error text in PLSQL process?
              PPlatt

              Thanks for your suggestions.  I've found the quick and easy solution.

              Rather than RAISE_APPLICATION_ERROR(-20001,'Message...') use

              APEX_ERROR.ADD_ERROR (

                  p_message          in varchar2,

                  p_additional_info  in varchar2 default null,

                  p_display_location in varchar2 );

              See

              http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_error.htm#CABDJBGJ

               

              APEX_ERROR.ADD_ERROR renders HTML in the p_message while RAISE_APPLICATION_ERROR doesn't.

              thanks  Lakshmi and fac586

              PaulP