Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Naming conventions?

Re: Naming conventions?

From: Karsten Schmidt <groups_at_karsten-schmidt.com>
Date: 12 Jun 2002 00:17:29 -0700
Message-ID: <c6711ac4.0206112317.27ae531e@posting.google.com>


Hi there,
 a quote from the development guideline (from the dba perspective) that I am currently writing....

use sensible names



Have you ever gotten the error message

ORA-????? Constraint SYS002345 violated
Explicitly naming all indexes and constraints together with a reasonable naming convention helps a lot. Your helpdesk staff is going to thank you.

We don't really care which naming convention you use, just one thing that you should be aware of. It is a bad idea to use prefixes or suffixes to distinguish between tables / views / synonyms. Suppose, your naming convention is to have the '_TAB' suffix for all your tables. According to that naming convention, the department table would be called DEPART_TAB. As time goes by, your application gets a second login, perhaps for auditing, or for security reasons. To avoid code changes, we use synonyms or views that point at the original tables. Now we would have to create a synonym that is called DEPART_TAB. Confusing at best. Don't do that. You shouldn't care whether you are doing DML against a table or a view or a synonym. This is one of the reasons why you are using a relational database in the first place.

Karsten

"Steve M" <steve.mcdaniels_at_vuinteractive.com> wrote in message news:<ae5r9r$mvc$1_at_spiney.sierra.com>...
> Here is the official list of standards: (empty list)
>
> Here is my list of standards.
>
> Never let the Oracle database assign your primary key names (e.g.,
> SYS301223)
>
> primary keys: PK_table_name e.g., PK_addresses
>
> indexed field I_table_name_field_name e.g., I_addresses_zipcode
>
> unique indexed field IU_table_name_field_name e.g.,
> IU_city_state_citystate
>
> always use underscores to separate words in names e.g., date_of_birth
> rather than dateofbirth
>
> never depend on case to infer meaning e.g., bad: MyTableName
> (MYTABLENAME) ==> MY_TABLE_NAME
>
> all datafiles should end in the same extension e.g., .dbf (.dat is ok,
> but lots of different apps use this.)
>
> I use <something>data for tablespace names and <something>user for usernames
> e.g. CUSTDATA and CUSTUSER
>
> Use the same indentation style for all queries. I use:
> select <field names....>
> from <tablenames...>
> where <conditions....>
> <AND/OR> <conditions>
>
> We do warehouse-style processing here, so for us it is important to know
> when we're using a view versus a regular table.
> So, we use V_<name> to indicate a view. e.g., select * from
> v_show_jobs
>
> <not so standard but helpful>
> I use the form MY_<fieldname> for local (procedural) variables which hold
> table data. e.g.,
>
> select address1, address2 into my_address1, my_address2 from addresses
> where address_id = my_address_id;
>
>
> "Tintin" <nospam_at_nospam.com> wrote in message
> news:BvsK8.18587$LC3.1333010_at_bgtnsc04-news.ops.worldnet.att.net...
> > Does anyone have a good naming convention for table, columns, indexes,
> etc.
> > that I can use? From what I see, I don't think Oracle has one. I tried
> to
> > make up my own, but came across some problems.
> >
> > Thank you.
> >
> > ~ !T
> >
> >
Received on Wed Jun 12 2002 - 02:17:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US