Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I force a page process to fail based on a value returned from a procedure?

PhilMan2Apr 21 2018 — edited Apr 25 2018

Hello,

I'm using Apex 5.1.4.00.08 and Oracle 11.g on a Windows 10 platform.

I'm enhancing an existing page with some error checking.  After the user presses the submit button, a process is launched.

That process calls a stored procedure which inserts a row into a single table.  In the stored procedure when the EXCEPTION logic encounters an error, it sets the values of:

  • p_error_num
  • p_error_msg
  • p_error_backktrace
  • p_error_stack

Those values are written to an error log table.  Also, those values are returned to the procedure originally called by the page process.

How do I receive the four values from the called procedure and evaluate them?  If p_error_num is not null, I'd like to halt the page processing and display an error to the user using the contents of p_erorr_num.

I drafted the page process.  The APEX editor is suggesting that I have to define the p_error_num, p_error_msg, etc. variables.  Right now the page process looks like:

DECLARE

    l_calling_module        varchar2(512);

BEGIN

    l_calling_module := 'Library App 104 Page 133 Process 30 - Insert Into LIB_BOOK';

    pkg_lib_create_or_update_book.create_book(

      p_isbn_10                     => :P133_ISBN_10

     (other assignments removed brevity's sake)

    , p_book_status                    => :P133_BOOK_STATUS

    , p_calling_module                => l_calling_module

    , p_error_num                    => :P133_ERROR_NUM

    , p_error_msg                    => :P133_ERROR_MSG

    , p_error_backtrace                => :P133_ERROR_BACKTRACE

    , p_error_stack                    => :P133_ERROR_STACK

    );

--    If p_error_num is not null

--    Then

--        (cause this process fail so that subsequent processes will not launch)

--       (Display :P133_ERROR_MSG in the process failure message to the user)

--    End If;   

END;

This post has been answered by Mint-Innit on Apr 23 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 23 2018
Added on Apr 21 2018
9 comments
887 views