Search code examples
databaseoracleoracle-sqldeveloper

Changed column name to upper case when create a new table through script in Oracle how to resolve this?


I am using Oracle tool (Oracle SQL Developer - Version 19.2.1.247). When i create new table in Oracle Db then it change all column name in uppercase i.e.(CUSTOMERID), but i want to keep column name i.e.(CustomerId).I am looking for solutions how to resolve this.

I did some try to change formatting of editor as well code setting in Tools -> Preference but not found any proper things.

Thanks in advance.


Solution

  • You should avoid doing that. Every object ( table, column, index, sequence, trigger... ) is stored in uppercase in the Oracle dictionary.

    However, if you want to store the name in lowercase, you must use double quotation

    SQL> create table test ( c1 number );
    
    Table created
    
    SQL> select column_name from all_tab_columns where table_name = 'TEST';
    
    COLUMN_NAME
    C1
    
    SQL> create table test ( "c1" number );
    
    Table created
    
    SQL> select column_name from all_tab_columns where table_name = 'TEST';
    
    COLUMN_NAME
    c1 
    

    Keep in mind that if you store the value in lowercase, any search or program that uses the dictionary will have to take this in consideration. That is why I believe it is not a good practice.