3

My table has column called select (or NOT, or other reserved keys).

I tried select 'select' column but I couldn't because oracle throw exception like this:

invalid user.table.column or table.column or column specification

My select statement like this:

 select f.select 
 from foo f.

I was searching internet and I found accepted answer: How do I escape a reserved word in Oracle?

then, I changed my query: Select "f"."select" from foo f, but throw exception too like this:

"c"."select": invalit identifier.

How to use "select" column in select (or update, insert) statement?

P.S: I'm using pl/sql developer tool for querying data.

Community
  • 1
  • 1
Baris
  • 445
  • 2
  • 10
  • 22
  • 7
    nice idea to create a column "select". You can also create a table called select. The query can be `select "select","update","insert","where" from "select" where "from" > "where" and "insert" = "update"`; – Florin Ghita Feb 07 '13 at 08:43
  • 1
    if you gave those columns their name, you shall be punished. besides that `f."select"`should work for you, but your column name is case-sensitive when used this way. Again, feel my wrath beeing aware THAT you used a RESERVED word and still did it. – Najzero Feb 07 '13 at 08:46
  • @Florin Ghita: I don't use any reserved keys but our customer maybe use it. We are writing framework for screen generation and maybe end user create column called 'select' and we have to select all column in the table. – Baris Feb 07 '13 at 09:07
  • @Baris Be cool, I've just made fun. I understand this might be a situation. – Florin Ghita Feb 07 '13 at 09:12
  • Supposing your customer wants to have a table name longer than thirty characters? Well they can't. There's no workaround for that. I know we're supposed to shield our users from the nasty implementation details. But sometimes it is better to expose some of the internals and impose constraints on our users, provided we give them more in return. In this case, in exchange for surrendering the ability to call a table "select" they get a more reliable and robust framework - because it will be easier to develop and maintain. – APC Feb 07 '13 at 09:15
  • @Florin Ghita Sory my english is bad. I'm relax :) – Baris Feb 07 '13 at 09:23

3 Answers3

2

Try,

Select f."select" from foo f;

enter image description here

Orangecrush
  • 1,970
  • 2
  • 15
  • 26
2

When identifiers are quoted in Oracle, they become case sensitive.

So it's likely that you have to write the following:

select f."SELECT" from foo f

(or "Select", or however you've actually written the column name)

CL.
  • 173,858
  • 17
  • 217
  • 259
1

This should work fine:

Select f."select" from foo f
Mahmoud Gamal
  • 78,257
  • 17
  • 139
  • 164