Name
SET ESCAPE
Synopsis
The ESCAPE setting specifies the character used to escape the substitution variable prefix.
Syntax
SET ESC[APE] {OFF | ON | escape_char}Parameters
- SET ESC[APE]
Is the command, which may be abbreviated SET ESC.
- OFF
Turns the escape feature off completely. SQL*Plus will not recognize any character as an escape character. This is the default setting.
- ON
Enables the escape feature and resets the escape character back to the default value, a backslash (\).
- escape_char
Is the new escape character. By default, this is a backslash.
Examples
You use the escape character when you want to place an ampersand in a command and you don't want that ampersand interpreted as a substitution variable prefix character. The following example shows a case where this can be a problem:
SQL> SELECT 'Matt & Joe Williams' FROM dual;
Enter value for joe:The ampersand in front of the word "Joe" causes SQL*Plus to interpret it as a substitution variable name. To work around this behavior, you can turn the escape feature on and precede the ampersand with a backslash. Here's an example:
SQL> SET ESCAPE ON SQL> SELECT 'Matt \& Joe Williams' FROM dual; 'MATT&JOEWILLIAMS' ------------------- Matt & Joe Williams
You can use the SET ESCAPE command to change the escape character to something other than a backslash.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access