4

I have a table with a field named COMMENT, which appears to be a reserved word.

Using SQLDeveloper, if I try:

select
  [COMMENT],
  another_field
FROM table_created_by_idiot_developer

I get

SQL Error: ORA-00936: missing expression

How can I access this field in my select in SQL Developer? (Is this a problem with SQL Developer, or should field not be named COMMENT in oracle?)

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
chris
  • 36,094
  • 53
  • 157
  • 237

1 Answers1

10

Try "COMMENT" instead of [COMMENT]. This is alternate syntax commonly accepted by various DBMSes. I have used this syntax to refer to columns having dots or UTF8 characters in their names in SQLite.

Benoit
  • 76,634
  • 23
  • 210
  • 236
  • 2
    More to the point, "..." is the correct syntax for delimiting an identifier in Oracle. – Jeffrey Kemp Oct 06 '10 at 00:11
  • Yes, `[]` is the true alternate syntax actually. – Benoit Oct 06 '10 at 07:35
  • 1
    Using reserved words for identifiers/objects is a nightmare - yes, you can create a schema, table, column all named "TABLE" - but you most definitely should not. Just makes things harder for yourself. – thatjeffsmith Oct 12 '18 at 12:57