When to use double quotes in Oracle column to avoid invalid identifier

Are you seeing an invalid identifier? Learn when to use double quotes in Oracle column names to avoid this in this tip from PL/SQL expert Dan Clamage.

I just created a table that has two columns, "notes_id" and "notes_name".

I then populated the tables from another table. When I run a query using

select * from notes_table

I see all the columns and all the data.

But, if I say

select notes_id from notes_table

it says I have an invalid identifier. I tried it on the other column name and got the same error. I even copied the column names from the create table ddl and it still gave me the error.

I am using Oracle 11.1.0.6. Can you help?

I’m guessing you included the double-quotes around the column names when you created the table? Since the column names are now lower-case, and Oracle always converts unquoted identifiers to upper-case, you must include double-quotes around the column names in your queries on this table. I.e., 

select "notes_id" from notes_table 

But I would recommend going back and recreating the table without the double-quotes. Or make the identifiers all upper-case if you insist on using double-quotes.

Have a question for Dan Clamage? Send an e-mail to [email protected]

.

Dig Deeper on Oracle development languages

Data Management
Business Analytics
SearchSAP
TheServerSide.com
  • The 3 daily Scrum questions

    The 2020 Scrum Guide removed all references to the three daily Scrum questions, but does that mean you shouldn't ask them anymore?

  • Why WebAssembly? Top 11 Wasm benefits

    Latency and lag time plague web applications that run JavaScript in the browser. Here are 11 reasons why WebAssembly has the ...

  • Why Java in 2023?

    Has there ever been a better time to be a Java programmer? From new Spring releases to active JUGs, the Java platform is ...

Data Center
Content Management
HRSoftware
Close