-1

we have migrated our Oracle Database to 12c. I have a given table with column names DATE and HOUR (not possible to change). Before I used this statement with c#:

command.CommandText = @"SELECT ""DATE"", ""HOUR"" FROM Table";

This statement is not running with 12c:

ORA-00911: invalid character

What do I have to change? Thanks

Kᴀτᴢ
  • 2,146
  • 6
  • 29
  • 57

2 Answers2

1

You can use double quotes (without the \ escape character) to specify a keyword as an identifier for an object in the database:

SELECT "DATE", "HOUR" FROM Table;

Note: If you are going to use double quotes around an identifier (which you have to do if you are using a keyword as a column name) then you are enforcing the use of a case-sensitive name for that column and you must always use the same case letters in the name every time you refer to it - see my answer here for more details.

Community
  • 1
  • 1
MT0
  • 143,790
  • 11
  • 59
  • 117
  • Thanks for the answer. In the Oracle SQL Developer this is working, but I need this for a query from c#. When I use only `"DATE"` it gives me an error because the string expects a `;` after the second `"` – Kᴀτᴢ Dec 13 '16 at 14:50
  • @katz You appear to be doing it correctly in the sample code given in your question given the answers here: [How to use a string with quotation marks inside it?](http://stackoverflow.com/questions/5540701/how-to-use-a-string-with-quotation-marks-inside-it) – MT0 Dec 13 '16 at 14:54
0

Driver issue

@katz - please fill in the details.
Thanks

David דודו Markovitz
  • 42,900
  • 6
  • 64
  • 88