Oracle and the Ampersand (&)

http://www.etstiles.com/?q=node/7
Oracle and the Ampersand (&)
Submitted by ets04uga on Tue, 11/06/2007 - 3:28pm.

    * Ampersand
    * Escape Character
    * Oracle

So I was looking around and couldn't seem to find out how to insert ampersand into an Oracle XE database, outside of SQL*Plus as in the following example:

INSERT INTO TABLE (COL1) VALUE ('A & B');

Normally one might try the standard backslash('\') as an escape character. One would be wrong.

I'm not sure of every possible solution, but found a quick (and seemlingy dirty) solution where the ampersand needs to be at the end next to a single quote. The following is the current solution I am using until a betters/best approach is found:

INSERT INTO TABLE (COL1) VALUE ('A &'||' B');

Hope this helps.

你可能感兴趣的:(oracle,sql)