39.16 UPDATE_MESSAGE Procedure Signature 2

This procedure updates a translatable text message and its attributes for the specified application.

Syntax

APEX_LANG.UPDATE_MESSAGE (
    p_id                 IN NUMBER,
    p_name               IN VARCHAR2,
    p_language           IN VARCHAR2,
    p_message_text       IN VARCHAR2,
    p_used_in_javascript IN BOOLEAN,
    p_comment            IN VARCHAR2,
    p_metadata           IN CLOB )

Parameters

Parameter Description
p_id The ID of the text message to be updated.
p_name The name of the translatable text message.
p_language The IANA language code for the mapping. Examples include en-us, fr-ca, ja, or he.
p_message_text The text of the translatable text message.
p_used_in_javascript Specify if the message needs to be used directly by JavaScript code (use the apex.lang JavaScript API).
p_comment Developer comments or notes only visible in the App Builder.
p_metadata Additional data stored alongside with the message. Note: This data is not used by Oracle APEX.

Example

The following example updates a translatable text message.

BEGIN
    --
    -- If running from SQLcl, we need to set the environment
    -- for the Oracle APEX workspace associated with this schema.
    -- The call to apex_util.set_workspace is not necessary if
    -- you're running within the context of the App Builder or an APEX
    -- application.
    --
    apex_util.set_workspace( 'SALES_DEV' );

    FOR l_message IN ( select translation_entry_id
                         FROM apex_application_translations
                        WHERE application_id       = 100
                          AND translatable_message = 'TOTAL_COST'
                          AND language_code        = 'en-us' )
    LOOP
        apex_lang.update_message(
            p_id                 => l_message.translation_entry_id,
            p_name               => 'SALES_TOTAL_COST',
            p_language           => 'en',
            p_message_text       => 'Total sales cost is: %0',
            p_used_in_javascript => true,
            p_comment            => 'What is the total cost of sales',
            p_metadata           => q'[{"Tag": "sales", "Approved": true}]' );
                                    -- Any additional data to store
    END LOOP;
END;