Solved

SQLPlus DESC Formatting

Posted on 2009-05-12
4
802 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.

Join & Write a Comment

Suggested Solutions

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now