Search code examples
oracle-databaseescapingspecial-charactersplsqldeveloper

Escape ampersand in PL/SQL Developer


I'm trying a simple INSERT statement against an Oracle database. One of the values is a VARCHAR2 field and the insert statement contains an ampersand. How do I do this? I've tried the following methods:

  1. Escape the & as \& with set escape on
  2. set scan off (this causes an ORA-00922 missing or invalid option error)
  3. set define off (this causes an ORA-00922 missing or invalid option error)

Any other ideas?


Solution

  • How I solved it is escaping the & with another &.

    For example:

    INSERT INTO Foo (Bar) VALUES ('Up && Away');
    

    Works nicely. Thanks for all the help