39.8 GET_MESSAGE Function

Translates text strings (or messages) generated from PL/SQL-stored procedures, functions, triggers, packaged procedures, and functions.

Syntax

APEX_LANG.GET_MESSAGE (
    p_name              IN VARCHAR2,
    p_params            IN apex_t_varchar2  DEFAULT apex_t_varchar2(),
    p_lang              IN VARCHAR2         DEFAULT NULL,
    p_application_id    IN NUMBER           DEFAULT NULL )
    RETURN VARCHAR2;

Parameters

Parameter Description
p_name Name of the message as defined in Text Messages under Shared Components of your application in Oracle APEX.
p_params List of parameter name value pairs to correspond to %my_name %my_age placeholders in the text message. They are replaced by the value of the named parameter processed left to right.
p_lang Language code for the message to be retrieved. If not specified, APEX uses the current language for the user as defined in the "Application Language Derived From" attribute.
p_application_id Specifies the application ID within the current workspace that owns the translated message you wish to return. Useful when coding packages that could be called outside of the scope of APEX such as packages called from a database job.

Example

The following example assumes you have defined a message called GREETING_MSG in your application in English as Good morning %name you are %age and in German as Guten Morgen %name, du bist %age.

The following example demonstrates how to invoke this message from PL/SQL:

DECLARE
    l_greetings varchar2( 32767 );
BEGIN
    l_greetings := apex_lang.get_message (
                       'GREETING_MSG',
                       apex_t_varchar2 (
                           'name', :P1_NAME,
                           'age',  :P1_AGE )
                       );
END;