?
Solved

SQLPlus DESC Formatting

Posted on 2009-05-12
4
Medium Priority
?
844 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Accepted Solution

by:
Milleniumaire earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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 setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

770 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