How do I escape a reserved word in Oracle?
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';
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.
double quotes worked in oracle when I had the keyword as one of the column name.
eg:
select t."size" from table t