Search code examples
oraclereserved-words

How do I escape a reserved word in Oracle?


In TSQL I could use something like Select [table] from tablename to select a column named "table".

How do I do this for reserved words in oracle?

Edit: I've tried square braces, double quotes, single quotes, and backquotes, they don't work...

As a further clarification, I have a column which someone named comment. As this is a reserved word oracle is chucking a wobbly trying to select with it, it's failing when parsing the query. I've tried Select "comment" from tablename but it didn't work. I'll check case and come back.


Solution

  • From a quick search, Oracle appears to use double quotes (", eg "table") and apparently requires the correct case—whereas, for anyone interested, MySQL defaults to using backticks (`) except when set to use double quotes for compatibility.