Search code examples
sqldatabaseoracleheaderescaping

Can I escape double quotes in column titles with Oracle?


Creating a table with a double quote to escape the real double quote doesn't seem to work in Oracle's SQL syntax:

CREATE TABLE "MyTable" (
"Col""umn 1" varchar(168)
);

The above fails. Is there any way to escape the double quote to make 'Col"umn 1'?


Solution

  • You can not. According to the documentation:

    Nonquoted identifiers can contain only alphanumeric characters from your database character set and the underscore (_), dollar sign ($), and pound sign (#). Database links can also contain periods (.) and "at" signs (@). Oracle strongly discourages you from using $ and # in nonquoted identifiers.

    Quoted identifiers can contain any characters and punctuations marks as well as spaces. However, neither quoted nor nonquoted identifiers can contain double quotation marks or the null character (\0).