ENQUOTE_LITERAL v17

The ENQUOTE_LITERAL function wraps single quotes around a string unless the string is already enclosed in single quotes.

Only an even number of single quotes are allowed in the string, excluding the enclosing quotes.

ENQUOTE_LITERAL(str VARCHAR2) RETURN VARCHAR2;

Parameters

str

The string to be wrapped in single quotes.

Examples

edb=# SELECT sys.DBMS_ASSERT.ENQUOTE_LITERAL('literal without ''''quotes') FROM DUAL;
      enquote_literal       
----------------------------
 'literal without ''quotes'
(1 row)

edb=# SELECT dbms_assert.ENQUOTE_LITERAL('''ab''') FROM dual;
 enquote_literal 
-----------------
 'ab'
(1 row)