ENQUOTE_NAME v17

The ENQUOTE_NAME function wraps quotation marks around a string, unless the input is already enclosed in quotation marks. All quotation marks within the string are appended with an quotation mark.

The following table shows examples of how quotes are handled.

Inputdolower parameterOutput
ab"cTRUE"ab""c"
"abc"TRUE"abc"
"a"bc"TRUE"a""bc"
ABCTRUE"abc"
ABCFALSE"ABC"
aBcTRUE"abc"
aBcFALSE"aBc"
ENQUOTE_NAME(str VARCHAR2, dolower boolean := TRUE) RETURN VARCHAR2;

Parameters

str

The string to be wrapped in quotation marks.

dolower

Optional. If TRUE, alphabetic characters in the input string that are not wrapped in quotation marks are converted to lower case. If FALSE, input strings are not converted to lower case.

Default is TRUE. Input not enclosed in quotes are converted to lower case.

Examples

edb=# SELECT SYS.DBMS_ASSERT.ENQUOTE_NAME('  ""ObjectName  ') FROM DUAL;
     enquote_name     
----------------------
 "  """"objectname  "
(1 row)

edb=# SELECT 'test' || SYS.DBMS_ASSERT.ENQUOTE_NAME('  "ObjectName"  ') || 'test' FROM dual;
         ?column?         
--------------------------
 test  "ObjectName"  test
(1 row)

edb=# EXEC DBMS_OUTPUT.put_line(SYS.DBMS_ASSERT.ENQUOTE_NAME('"REMAIN QUOTED and SAME CASE"'));
"REMAIN QUOTED and SAME CASE"