Oracle – How to Print Information of All Tables

oracle

I'm studying DDBB and we are using Oracle. Using too much tables can be really difficult for me because I have to remember table1.content2, table3.content1, etc.

So because of that, I would like to print (in paper) the header tables to make it easier.

I know my explanation is not very good so I tried to "draw it" below:

select * from user_tables;

table_name|
-----------
table1    |
-----------
table2    |
-----------
table3    |

What I want:

table1
-----------------------------
content1| content2| content3|

table2
-----------------------------
content1| content2| content3|

table3
-----------------------------
content1| content2| content3|

How can I get this in paper?

Thanks!

Best Answer

You can do a describe using SQLplus or SQL Developer: desc myschema.mytable This way you'll also see the column's datatype and whether it can be null or not.

desc myschema.category

Name           Null     Type           
-------------- -------- -------------- 
CATEGORY_ID    NOT NULL NUMBER(38)     
CATEGORY       NOT NULL VARCHAR2(40)   
SUBCATEGORY             VARCHAR2(40)   
MOD_DT         NOT NULL DATE           

If you want the fields listed horizontally, try select * from myschema.mytable where rownum = 1 This will bring you back one row, with all the column names listed on one line, although they may be spaced out considerably. This way, you'd also have a row of sample data.

select * from myschema.category where rownum = 1;

CATEGORY_ID            CATEGORY                                 SUBCATEGORY                              MOD_DT                   
---------------------- ---------------------------------------- ---------------------------------------- -------------------------
28                     My Category                              My Subcategory                           18-MAR-14 13:41.27