Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the schema name when I have table name?

Tags:

sql

oracle

I have a table name but I am not sure in which schema that table exists. How to find the schema name?

like image 314
bin Avatar asked Jun 09 '16 14:06

bin


People also ask

Is schema name the same as table name?

Because tables and views are in the same namespace, a table and a view in the same schema cannot have the same name. However, tables and indexes are in different namespaces. Therefore, a table and an index in the same schema can have the same name.

How do I find the schema of a database?

You can get a list of the schemas using an SSMS or T-SQL query. To do this in SSMS, you would connect to the SQL instance, expand the SQL database and view the schemas under the security folder. Alternatively, you could use the sys. schemas to get a list of database schemas and their respective owners.


2 Answers

Select owner
from dba_tables
where table_name = 'YOUR_TABLE_NAME'

Here you can find something more.

like image 56
Aleksej Avatar answered Sep 18 '22 08:09

Aleksej


Something like this should get the name of the table and the the schema it belongs to .

select owner, table_name 
 from all_tables 
 where table_name like 'GL%';
like image 24
z atef Avatar answered Sep 18 '22 08:09

z atef