How do I escape a reserved word in Oracle?
Solution 1:
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.
Solution 2:
Oracle normally requires double-quotes to delimit the name of identifiers in SQL statements, e.g.
SELECT "MyColumn" AS "MyColAlias"
FROM "MyTable" "Alias"
WHERE "ThisCol" = 'That Value';
However, it graciously allows omitting the double-quotes, in which case it quietly converts the identifier to uppercase:
SELECT MyColumn AS MyColAlias
FROM MyTable Alias
WHERE ThisCol = 'That Value';
gets internally converted to something like:
SELECT "ALIAS" . "MYCOLUMN" AS "MYCOLALIAS"
FROM "THEUSER" . "MYTABLE" "ALIAS"
WHERE "ALIAS" . "THISCOL" = 'That Value';