24.12 ENQUOTE_LITERAL Function
This function enquotes a string literal and escape contained quotes. This function works for all database types supported by Oracle APEX over REST-enabled SQL.
Syntax
APEX_EXEC.ENQUOTE_LITERAL (
p_str IN VARCHAR2,
p_for_database IN t_database_type DEFAULT NULL )
RETURN VARCHAR2;
Parameters
Table 24-9 ENQUOTE_LITERAL Parameters
Parameter | Description |
---|---|
p_str |
String literal 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 string literal.
Example
DECLARE
l_enquoted_literal varchar2(32767);
BEGIN
l_enquoted_literal := apex_exec.enquote_literal(
p_str => q'#O'Neil \n#',
p_for_database => c_database_oracle );
-- returns: 'O''Neil \n'
l_enquoted_literal := apex_exec.enquote_literal(
p_str => q'#O'Neil \n#',
p_for_database => c_database_mysql );
-- returns: 'O''Neil \\n'
END;
Parent topic: APEX_EXEC