Display exception messages


OK when you write a PLSQL procedure or function you should trap for exceptions.

Sometimes you might want to display these exceptions to the user. In this example it is the logging into the application and displaying if the user is locked.

So here is the snipped of the PLSQL code. Do not worry about what it is doing the main line is highlighted

if v_locked = 'N' then
 v_authenticated := authenticate_password(p_username => p_username,p_password => p_password);
 return(v_authenticated);
 else

 apex_util.set_session_state('LOGIN_MESSAGE','Your account is currently locked');

 return false;

 end if;

The important part here is the LOGIN_MESSAGE this will be used later on.

 

OK now go to the APEX application and open the application in question that you want to add a message to

There are a few screen grabs to make the teach in a bit easier

Please note that LOGIN_MESSAGE is used throughout and when creating the region the source is &LOGIN_MESSAGE.

Please take note of the . after MESSAGE.

 

Create the application item first

 

Now create a region

 

Testing the application

 

There is more to come, I am just getting started. This may not be the best way to do things but it is a start 🙂

 

 

 

 

 

 

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s