Using mixed case for table and column names

Posted on 2008-10-17
Last Modified: 2013-12-18
We're used to developing systems for MS-SQL, and our standards have grown up around using mixed case identifiers--tables and columns--as allowed in MS-SQL.  We have a new project that is using an Oracle back-end, and we're discovering that our standards don't play so well in the Oracle world.  Mixed-case seems to be allowed, but it seems that our queries will have to make extensive use of double-quotes to accommodate this.  

Can someone please summarize (or point me to) some current object naming standards for Oracle development work?  Thank you in advance!
Question by:roblinx
  • 3
  • 3
  • 2
  • +1
LVL 18

Assisted Solution

sventhan earned 200 total points
ID: 22744973
LVL 18

Assisted Solution

sventhan earned 200 total points
ID: 22744978

Author Comment

ID: 22745016
Hmm... these are helpful--thank you--but they don't seem to address the issue of letter case.  Have any more?  :-)

Accepted Solution

hqassap earned 250 total points
ID: 22747509


You have to use double quotes  in the DDL statements (Create, Alter, and Drop) and in DML statements (Insert, Update, and Delete); further to the Select query statements.

Following examples show you that in some details:

ccc @ TNNGT2> CREATE TABLE "TEst" ("No" NUMBER(2), "NAme" VARCHAR2(20));

Table created.

ccc @ TNNGT2>
ccc @ TNNGT2> SELECT table_name
  2    FROM user_tables
  3   WHERE table_name = 'TEst';


ccc @ TNNGT2>
ccc @ TNNGT2> SELECT table_name, column_name , data_type
  2    FROM user_tab_columns
  3   WHERE column_name IN ('No', 'NAme');

TABLE_NAME                     COLUMN_NAME                    DATA_TYPE
------------------------------ ------------------------------ -------------------------------------------
TEst                           No                             NUMBER
TEst                           NAme                           VARCHAR2

2 rows selected.

ccc @ TNNGT2>
  2              ("No", "NAme")
  3       VALUES (1, 'ABC');

1 row created.

ccc @ TNNGT2>
ccc @ TNNGT2> COMMIT ;

Commit complete.

ccc @ TNNGT2>
ccc @ TNNGT2> SELECT *
  2    FROM "TEst";

        No NAme
---------- --------------------
         1 ABC

ccc @ TNNGT2>
ccc @ TNNGT2> DROP TABLE "TEst";

Table dropped.
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

LVL 18

Expert Comment

ID: 22747736
Use UPPER, LOWER functions to handle the case for upper and lower.

Author Comment

ID: 22748232
Thanks guys... all very helpful!

What I'm looking for is opinions about best practices.  We had gotten it into our heads (thanks to MSSQL work) that all-caps is bad, and underscores were wasted space.  But... if Oracle requires the use of double-quotes to make use of mixed case for table and column names, perhaps it's not worth it.  

What do you do when developing applications for Oracle databases?  Mixed-case, or all caps?

Assisted Solution

hqassap earned 250 total points
ID: 22751300

Find below link for Naming conventions for Oracle tables, columns, indexes:

Also, you can use such Code formatters such as Formatter Plus (product of Quest)
LVL 23

Assisted Solution

David earned 50 total points
ID: 22792681
Always upper case for object names such as tables and columns.  Data content may be whatever you want, provided you're willing to search on all case possibilities.  See sventhan's comment for a best practice to make your search string always one case, usually upper -- as in "SELECT ... WHERE UPPER(columnname) = "ALLCAP";

Author Comment

ID: 22797797
Thanks, experts, for your opinions and advice!

We ended up going against our MS-SQL background, using all-caps table and field names that employed underscores to separate words, where there was more than one word.  




I spread the credit around, as I did read and benefit from your answers.  Thank you.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle Database creation fails 5 50
Oracle function works in 11g but not in 12c 21 72
sql for Oracle views 8 49
data lookup in Oracle - need suggestions 55 104
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now