Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using mixed case for table and column names

Posted on 2008-10-17
9
Medium Priority
?
1,401 Views
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!
0
Comment
Question by:roblinx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 18

Assisted Solution

by:sventhan
sventhan earned 800 total points
ID: 22744973
0
 
LVL 18

Assisted Solution

by:sventhan
sventhan earned 800 total points
ID: 22744978
0
 

Author Comment

by:roblinx
ID: 22745016
Hmm... these are helpful--thank you--but they don't seem to address the issue of letter case.  Have any more?  :-)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 4

Accepted Solution

by:
hqassap earned 1000 total points
ID: 22747509

Hello,

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';

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>
ccc @ TNNGT2> INSERT INTO "TEst"
  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.
0
 
LVL 18

Expert Comment

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

Author Comment

by:roblinx
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?
0
 
LVL 4

Assisted Solution

by:hqassap
hqassap earned 1000 total points
ID: 22751300
Hi,

Find below link for Naming conventions for Oracle tables, columns, indexes:
http://www.gplivna.eu/papers/naming_conventions.htm

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

Assisted Solution

by:David
David earned 200 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";
 
0
 

Author Comment

by:roblinx
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.  

Examples:

BUSINESS_FUNCTIONS
USER_DIVISION_XREF

DIVISION_ID
CREATED_BY

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

670 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