1.Overview

This document talks about how to use the apex error notifications & to manage into custom error messages.

2.Technologies and Tools Used

The following technology has been used to achieve Custom Notifications

  • Oracle Apex

3.Use Case

Assume that there is a requirement to change or add any customization to the apex notifications.

4.Architecture

Following steps explains in detail,

Step 1:  Create a text field item P11_ENAME.

 

Step 2:

Create a File Browse Item P11_FILE_BROWSE and change the Storage Type as APEX_APPLICATION_TEMP_FILES and Change the Purge File at End of Session.

Step 3:

Create an Application Process Insert Image and copy the below code as source.

The code contains two packages as apex_application.g_print_success_message for Success and apex_error.add_error  for Error Messages. You can change the Message info based on the requirement.

Code :

DECLARE

v_blob      BLOB;

v_emp_cnt   NUMBER;

v_name      VARCHAR2 (100);

v_sno       NUMBER;

BEGIN

BEGIN

SELECT blob_content, NAME

INTO v_blob, v_name

FROM apex_application_temp_files

WHERE ID = (SELECT MAX (ID)

FROM apex_application_temp_files);

EXCEPTION

WHEN OTHERS

THEN

raise_application_error (-20038, ‘Table’);

END;

BEGIN

SELECT NVL (MAX (sno), 0) + 1

INTO v_sno

FROM emp_files;

–RAISE_APPLICATION_ERROR(-20034,v_sno);

END;

BEGIN

IF :p11_empno IS NOT NULL

THEN

BEGIN

SELECT COUNT (1)

INTO v_emp_cnt

FROM emp123

WHERE empno = :p11_empno;

IF v_emp_cnt = 1

THEN

BEGIN

INSERT INTO emp_files

(sno, empno, file_name, blob_content

)

VALUES (v_sno, :p11_empno, v_name, v_blob

);

COMMIT;

apex_application.g_print_success_message :=

‘<span style=”color : white “>Success :</span>’

|| TRIM (:p11_empno);

EXCEPTION

WHEN OTHERS

THEN

raise_application_error (-20098,

SQLERRM || ‘-‘ || ‘INSIDE’

);

END;

ELSE

/*  apex_application.g_print_success_message :=

‘<span style=”color : white “>Error in Uploading Image for Employee :</span>’

|| TRIM (:p11_empno);*/

apex_error.add_error

(p_message               =>    ‘Employee No : ‘

|| :p11_empno

|| ‘ already exists.’,

p_display_location      => apex_error.c_inline_in_notification

);

END IF;

END;

ELSE

apex_error.add_error

(p_message               => ‘No value in the Employee number field.’,

p_display_location      => apex_error.c_inline_in_notification

);

END IF;

END;

END;

1.Screen Shot

 Default Message

Default Error Message

Output

Success Message

Error Message

Recent Posts

Start typing and press Enter to search