Question:
Can we make two tables of same name in oracle 9i ?
deepesh
2007-06-30 08:33:41 UTC
I have to make two tables of same name in Oracle 9i,there structures may be different.
Five answers:
McFate
2007-06-30 09:09:15 UTC
You can do it if you place them in different schemas, but then the fully qualified name of the table is not the same any more:



schema1.myTable

vs

schema2.myTable
Orion
2007-07-02 22:28:53 UTC
Just out of curiousity why would you need the table names to be the same? #1 it's not doable in the same schema and I don't see any benefit to doing this. Even if you create this in two different schemas you will have to point to your schema.table_name in your SQL or PL/SQL or front end 3GL code. Just use a seperate table name and join based on your primary key. From there you could create a view as mentioned above or pass into your 3GL code to display the appropriate output.
Jeffrey F
2007-06-30 10:03:57 UTC
you would need to alias the tables to prevent confusion. The tables of the same name can not exist in the same schema
coolblue00
2007-07-02 11:53:41 UTC
another twist:

If you *got to have* one name,

you could create the 2 different tables as mentioned by junglejungle and then join them (provided they have a common key) under a view which then has the name you desire - but remember views have their own restrictions.



You could also post more information/ details about your question.



Hope that helped.
junglejungle
2007-06-30 08:38:46 UTC
nope you can't besides it would be confusing for SQL queries...



you can have tables like



emp_details

emp_job



etc.



but using the EXACT name is confusing. learn up about primary + foreign keys also ;-)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...