How to get all column names of a Table in Oracle

To get all column names of a Table in Oracle you can use the following snippet.

SELECT table_name, column_name, data_type, data_length
FROM USER_TAB_COLUMNS
WHERE table_name = 'TABLENAME'

If you are using MSSQL, take a look at this snippet -> How to list all columns from a table in MSSQL

Please rate this snippet

How to get a list of all tables in Oracle

To get a list of all tables in Oracle you can use the following query.

SELECT owner, table_name FROM dba_tables

if your user does not have sufficient access rights to query dba_tables, you can try to query all_tables which will only show you the tables you are allowed to see.

SELECT owner, table_name FROM all_tables

Please rate this snippet