I thought that the quotation mark (‘) was simply a type of grouping marker but I’m debugging some NHibernate code and notice that while
SELECT * FROM site WHERE site_id = 3;
Works fine
SELECT * FROM 'site' WHERE site_id = 3;
fails with a table or view does not exist error.
What gives?
Putting double-quotes around an identifier in Oracle causes Oracle to treat the identifier as case sensitive rather than using the default of case-insensitivity. If you create a table (or a column) with double-quotes around the name, you must always refer to the identifier with double quotes and by correctly specifying the case (with the exception of all upper case identifiers, where double-quotes are meaningless).
Under the covers, Oracle is always doing case-sensitive identifier matching. But it always casts identifiers that are not double-quoted to upper case before doing the matching. If you put double-quotes around an identifier, Oracle skips the casting to upper case.
So if you do something like
you can
but something like
will fail.
On the other hand, if you do something like
you cannot do
but this
will work