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: Brian Peasland <dba_at_nospam.peasland.net>
Date: Fri, 3 Nov 2006 16:58:13 GMT
Message-ID: <J85z54.97x@igsrsparc2.er.usgs.gov>


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

What if Oracle allowed you do to the following:

CREATE TABLE woohoo (id NUMBER);

CREATE SYNONYM woohoo FOR scott.emp;

Now if the above were to be allowed, then what object would Oracle refernece in the following:

SELECT * FROM woohoo;

Oracle does not know if you mean the table WOOHOO or the synonym which points to SCOTT.EMP.

In some cases, it would be possible...using the given context..to determine which object you mean as in the following:

DROP TABLE woohoo;
DROP SYNONYM woohoo;

But given that there is a chance that the context is not easily resolvable, Oracle leans towards the convention that no two objects in the schema will share the same name.

HTH,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Received on Fri Nov 03 2006 - 10:58:13 CST

Original text of this message

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