Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using mixed case for table and column names

Posted on 2008-10-17
9
Medium Priority
?
1,433 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
  • 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
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

879 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