Oracle equiv of mysql show tables ?

B

Betty

Perhaps OT, but don't know where to post.

In MySQL we have "show databases" and "show tables"
What is the equivalent in Oracle if any?
Can I achieve the same result by doing a
select on one of the Oracle maintained tables?
TIA
Betty
 
D

Dimitri Maziuk

Betty sez:
Perhaps OT, but don't know where to post.

In MySQL we have "show databases" and "show tables"
What is the equivalent in Oracle if any?

Oracle has no "databases". It has schemas that are usually
the same as user names.
Can I achieve the same result by doing a
select on one of the Oracle maintained tables?

Yes. Select from [SYS.]DBA_*, USER_*, and ALL_* views.
E.g. if your user/schema name is betty,
"SELECT TABLE_NAME FROM ALL_TABLES WHERE OWNER='betty'"
or
"SELECT TABLE_NAME FROM USER_TABLES"
will give you the list of tables in "betty" schema.

"SELECT USERNAME FROM ALL_USERS" will give you the list of
users, hopefully your dba didn't do anything fancy and the
list is equvalent to "show databases" -- more or less: there
are a few system users in it, too.

You'll have to log in as dba to get to DBA_* views.

Dima
 
D

Dimitri Maziuk

Thomas Kellerer sez:
As you are doing this in Java I would recommend using DatabaseMetaData to
retrieve this kind of information:

Still won't work unless you know that on Oracle you need to
put getUsername() in schema parameter whereas on other engines
you need to specify catalog -- or nothing at all, depending.

Dima
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top