Home » RDBMS Server » Server Administration » Describing all the tables in a database
Describing all the tables in a database [message #374493] Thu, 14 June 2001 17:29 Go to next message
Asim
Messages: 8
Registered: October 2000
Junior Member
Hi
I am trying to describe all the tables in a database.

We use desc or describe tablename; to describe a table, but what is the command to describe all the tables in a database (i don't need the system tables)

Once i log into sqlplus as a say ABC (SID or HostString) as a user then if i do a desc table name i get column name, data type and null not null etc but i i need that for all the tables in that ABC database

Thanks
-Asim
Re: Describing all the tables in a database [message #374507 is a reply to message #374493] Fri, 15 June 2001 08:01 Go to previous messageGo to next message
Bala
Messages: 205
Registered: November 1999
Senior Member
Hi,

cut and past this following lines into a notepad and call it as desc.sql

set echo off;
set head off;

spool describe.sql
select 'desc ' || table_name || ';' from all_tables where owner not in
('SYS', 'SYSTEM');

spool off;
set echo on;
set head on;
@describe.sql

now log on to you ABC database and run
SQL> @full path of your desc.sql
ex.
SQL> @C:/myscripts/desc.sql

Bala.
Re: Describing all the tables in a database [message #374516 is a reply to message #374507] Fri, 15 June 2001 15:17 Go to previous messageGo to next message
Asim
Messages: 8
Registered: October 2000
Junior Member
Thanks, i guess next to get table details i have run that o/p as a another sql file and spool it to another o/p file right?
-Asim
Re: Describing all the tables in a database [message #374517 is a reply to message #374507] Fri, 15 June 2001 16:33 Go to previous message
Asim
Messages: 8
Registered: October 2000
Junior Member
Thanks Bala

I still have to run that to another file and then spool that file to o/p to get table description, right

i did get some error though when i tried to get table description

Anyways thanks a bunch for your suggestion

-Asim
Previous Topic: update multiple fields
Next Topic: Database name
Goto Forum:
  


Current Time: Sat Jul 06 18:47:37 CDT 2024