22.13 ENQUOTE_NAME Function

This function enquotes a database object name and (if applicable) escape contained quotes. This function works for all database types supported by Oracle APEX over REST-enabled SQL.

Syntax

APEX_EXEC.ENQUOTE_NAME (
    p_str               IN VARCHAR2,
    p_for_database      IN t_database_type DEFAULT NULL )
RETURN VARCHAR2;

Parameters

Table 22-10 ENQUOTE_NAME Parameters

Parameter Description
p_str Object name to enquote.
p_for_database

Target database to enquote for.

If omitted, the function enquotes for the target database of the currently executed region.

Returns

This function returns the enquoted object name.

Example

DECLARE
    l_enquoted_literal varchar2(32767);
BEGIN
    l_enquoted_literal := apex_exec.enquote_name(
                            p_str          => q'emp',
                            p_for_database => c_database_oracle );

    -- returns: "emp"
 
    l_enquoted_literal := apex_exec.enquote_name(
                            p_str          => q'emp#',
                            p_for_database => c_database_mysql );

    -- returns: `emp`
END;