Thursday, October 10, 2019

OGB Appreciation Day: add an error in a PL/SQL Process to the inline notification in Oracle APEX

This post is part of the OGB (Oracle Groundbreakers) Appreciation Day 2019, a thank you to everyone that makes the community great, especially those people that work at keeping us all moving!

Before I give my tip on how to add an error message from your PL/SQL code in your Page Process to a notification message in Oracle APEX, I want to start with thanking some people.

What keeps me going are a few things:

  • The innovations of technology and more specifically the Oracle Database, ORDS, and Oracle APEX. I want to thank all the developers and the people behind those products. They allow me to help other people with the tools they create and keep on learning about the new features that are released. 
  • I want to thank the fantastic #orclapex (Oracle APEX) and Groundbreakers community. I believe we are a great example of how people help and support each other and are motivated to bring the technology further. Over time I got to know a lot of people, many I consider now friends.
  • I want to thank you because you read this, show your appreciation and push me forward to share more. I'm passionate about the technology I use. I love helping people with my skill set of developing software and while I learn, share my knowledge through this blog. 

So back to my tip of today... how do you show a message in the notification on a page?


You can do that with the APEX_ERROR PL/SQL API.


To see the usage yourself, create an empty page, with one region and a button that submits the page.
In the Submit Process, simulate some PL/SQL Code where you raise an error.

For example:


That's it! Now you can get your errors in the notification message area of your Oracle APEX Page.

2 comments:

Fahd said...

Error is also shown in notification by using only RAISE_APPLICATION_ERROR, then why use APEX_ERROR.ADD_ERROR function ?

Helmut Steeman said...

That's right but apex_error.add_error is an overloaded function with several parameters, like page_item and display location that can be notification and/or in line with field (or error page which I would not use). If you chose page_itema and display location c_inline_with_field_and_notif, then you see in which page item the error occurred and you can click on it (it' san URL) in the notification to go that page item.