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: Why Oracle Enforce Name Uniquness ???!!!

Re: Why Oracle Enforce Name Uniquness ???!!!

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 3 Nov 2006 10:51:07 -0800
Message-ID: <1162579867.831731.174790@h54g2000cwb.googlegroups.com>

On Nov 3, 1:05 pm, "EdStevens" <quetico_..._at_yahoo.com> wrote:
> klabu wrote:
> > Dang !
>
> > why Oracle does not allow a table to have same name as another object type
> > ???!!!
>
> > SQL> create or replace package woohoo is procedure p_woohoo; end ;
> > 2 /
>
> > Package created
>
> > SQL> create table woohoo as select * from scott.emp;
>
> > ORA-00955: name is already used by an existing object
>
> > <10gR2>Well, one could discuss "why Oracle does not allow..." until the cows
> come home. The fact is, within a schema, it doesn't allow it. So, we
> move on and decide how to deal with it. I'd ask why would you even
> WANT two objects to have the same name? If one takes the common and
> easy approach of naming tables roughly after the entities they describe
> (EMPLOYEE, PURCHASE_ORDER, etc) and procedures after what they DO ..
> (COMPUTE_FICA, FIRE_EMPLOYEE, etc.) there would be no problem. In
> other words, table names are nouns, procedure names are verbs. Some go
> even further by adding an object_type_prefix to the object name,
> especially for procedural code: "TR_" for triggers, "PKG_" for
> packages, "FN_" for functions, etc.
>
> But then, my roots are in COBOL on IBM mainframes, so I've spent a lot
> of time on nameing standards that pack as much information about the
> named object into as concise a format as possible.- Hide quoted text -- Show quoted text -

Either no mentioned it or I missed the commnet but Oracle only allows one object to have a specifc name within a NAMESPACE. You can find the old Oracle definition of a namespace in the Application Developers Guide - Fundamentals

>>

Oracle has separate namespaces for different classes of objects. All objects in the same namespace must have distinct names, but two objects in different namespaces can have the same name. Tables, views, snapshots, sequences, synonyms, procedures, functions, and packages are in a single namespace. Triggers, indexes, and clusters each have their own individual namespace. For example, there can be a table, trigger, and index all named SCOTT.EMP_TAB.
<<

The term namespace also has special meaning in realation to XML.

HTH -- Mark D Powell -- Received on Fri Nov 03 2006 - 12:51:07 CST

Original text of this message

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