HJW
HJW

Reputation: 23443

Is there an Oracle's equivalent of MySQL's show table command?

I know it is possible to use:

SELECT DISTINCT(table_name) 
  FROM all_tab_cols

Would there be a better way in Oracle to show table, i.e. MySQL's show table; command.

Upvotes: 5

Views: 7547

Answers (6)

Osama Al-Banna
Osama Al-Banna

Reputation: 1515

Yes to all the tables that belong to your current user/schema run the below Query in Oracle database:-

SELECT TABLE_NAME FROM USER_TABLES;.

Upvotes: 0

Bugalugs Nash
Bugalugs Nash

Reputation: 492

describe <table-name>

in SQL*Plus

Upvotes: 1

Rene
Rene

Reputation: 10541

Off course this depends on your use. Do you need the information in a program or do you want to have a look at the table structure yourself? Many tools will give you a view of the table structure including: PLSQL developer, Toad for Oracle, SQLDeveloper. If you want to use the table structure in a query better resort to the Oracle data dictionary views (user_..., all_..., dba_...)

Upvotes: 0

9000
9000

Reputation: 40884

Try describe table <table-name> in SQL*Plus. It does all the fetching and nice formatting. Works with tables, but also procedures, triggers, constraints, etc (just use different keywords).

Upvotes: 4

Narayan
Narayan

Reputation: 6241

If you require full structure you may use

SELECT dbms_metadata.get_ddl( 'TABLE', 'MY_TABLE_NAME' ) FROM DUAL;

see more syntax from Reference

Upvotes: 8

Greg Reynolds
Greg Reynolds

Reputation: 10186

You can do

select * from user_tables;

To get basic stuff. To get just the tablenames:

select table_name from user_tables;

Upvotes: 1

Related Questions