Solved

SQLPlus DESC Formatting

Posted on 2009-05-12
4
812 Views
Last Modified: 2013-12-18
Hello,

In SQLPlus it seems the output of a DESC command on a table does not respect COL <col_name> FORMAT Ann.  I'd like to trim the TYPE and NAME output to about 25 characters.

How can one do this?

Thanks,

Michael
Name                                                                                                                              Null?
Type
 ----------------------------------------------------------------------------------------------------------------------------------------- -
------- --------------------------------------------------------------------------------------------
 ADDITIONALACCOUNTS_ID                                                                                                             NOT NULL
NUMBER(12)
 CUMEMBERS_ID                                                                                                                      NOT NULL
NUMBER(12)
 ADDITIONALACCT
NUMBER(9)
 CREATETIMESTAMP
DATE
 UPDATETIMESTAMP
DATE
 UPDATECOUNTER
NUMBER(12)
 DELETED
NUMBER(12)

Open in new window

0
Comment
Question by:michael4606
4 Comments
 
LVL 16

Accepted Solution

by:
Milleniumaire earned 500 total points
ID: 24363798
Have you tried reducing the setting of linesize as this affects the column sizes used by describe.

e.g. set linesize 80
0
 

Expert Comment

by:atyrsvc
ID: 24363882
Instead of DESC <table>, you can do query on DICT tables like Select * from all_tables where table_name = 'XYZ'. This query will honor your COL format. You can save this in a script like DESC1 and have tablename as parameter for easy access.
0
 

Author Closing Comment

by:michael4606
ID: 31580499
Bingo - that was it.

Milleniumaire thanks for posting!
0
 
LVL 11

Expert Comment

by:Andytw
ID: 24363936
Milleniumaire is correct, use linesize

See Extract from the Oracle Docs SQL*Plus® User's Guide and Reference
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/toc.htm

<snip>
To format the DESCRIBE output use the SET command as follows:

SET LINESIZE 80
SET DESCRIBE DEPTH 2
SET DESCRIBE INDENT ON
SET DESCRIBE LINE OFF
To display the settings for the object, use the SHOW command as follows:

SHOW DESCRIBE
DESCRIBE DEPTH 2 LINENUM OFF INDENT ON
</snip>
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best RAID for a BDD Oracle 4 69
Oracle Pivot Question 8 62
Query to identify changes between rows of two tables 8 47
Oracle - SQL Query with Function 3 35
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question