2

Is there any query that can be used to retrive the Tables and its column attributes like column name , datatype, nullable etc for all the tables inside the database

For Oracle Pl/SQL

Radu Gheorghiu
  • 20,049
  • 16
  • 72
  • 107
  • Plsql and SQL Server? Odd combination. Perhaps they both have INFORMATION_SCHEMA support? – jarlh Oct 22 '15 at 09:30

1 Answers1

2

The Oracle SQL you need would be the following (run as user 'SYS'):

select owner, table_name, column_name, data_type, nullable
from dba_tab_columns;

If you do a desc dba_tab_columns you will get a list of many more columns which may be of interest to you as part of your result set.
You can use a SQL tool (i.e. SQL*Plus) to run this query or you can use PL/SQL to call this query and put the results in PL/SQL variables then print them out via DBMS_OUTPUT.PUT_LINE().

HTH

tale852150
  • 1,618
  • 3
  • 17
  • 23