Search code examples
oracle-databaseoracle-sqldeveloperidentifier

Invalid identifier when selecting from table with fieldnames in lower case


I imported data from a csv file and created a new table. The first row was the header.

When I am trying to run some simple queries to these tables I get an ORA-00904 invalid identifier error.

The only difference between usual tables and the tables with imported data is that the fieldnames in the latter are in lower case, whereas in usual tables they are always in uppercase.

Could that be a reason for the error?


Solution

  • When you use the "" in your DDL then you make your column names case sensitive.

    so if the DDL is like this:

    CREATE TABLE "DWH"."TEST_PROBA" ( "credit_num" VARCHAR2(11 BYTE) NOT NULL ENABLE, 
    "term_acc_open_date" DATE NOT NULL ENABLE, 
    "date_final_pmt_exp" DATE, "dpd_1" VARCHAR2(5 BYTE) NOT NULL ENABLE, 
    "dpd_2" VARCHAR2(5 BYTE) NOT NULL ENABLE, 
    "dpd_3" VARCHAR2(5 BYTE) NOT NULL ENABLE, 
    "dpd_4" VARCHAR2(5 BYTE) NOT NULL ENABLE, 
    etc
    

    Then you need to query like this:

    SELECT "credit_num", "term_acc_open_date", etc...
    FROM "TEST_PROBA"