Oracle: Ampersand (&) substitution in SQL Developer

Try this:
SELECT 'HELLO & GOODBYE' FROM DUAL;
and you will get a popup:

Ampersand is used to denote a substitution variable, great, but in this case I just want the & character in my string. A workaround is to put the ampersand at the end of a string, so the following will work:
SELECT 'HELLO &' || ' GOODBYE' FROM DUAL;
Where || is the Oracle string concatenation function.

Advertisements

3 responses to “Oracle: Ampersand (&) substitution in SQL Developer

  1. or you can first run this right in SQL developer: “set define off;”

    which turns off substitution and leaves ampersands in strings alone until you open a new session or reverse it wth “set define on;”

  2. Raju Nagulapalli

    This below solution will work.
    select ‘TEST1’||’&’||’TEST2’ from dual;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s