formating
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: formating

  1. #1
    Join Date
    Jan 2001
    Posts
    216
    Hi

    Whenever, I select rows from our tables, the results are very hard to read as they get wrapped over several lines. Is there a way by which we can format all the columns in them to a more readable format ? like trim the varchars.

    It will be great if there is a script for this, eg called setTableFormat.sql. Just before I select data from tables, in sql prompt, I can call this script. The script must be a generic one for all tables, I do not want to specify the column names there.

    If you know of anything like that, please let me know

    Thanks in advance for your help
    Neelima

  2. #2
    Join Date
    Mar 2001
    Posts
    26
    What tool are you using to view your data? Is it SQL*PLUS?

    If yes, you need to find the 'glogin.sql' file in your Oracle directory. This files contains all global paramters when you log into the system. Simply add the following line at the end of the file:

    SET LINESIZE 2000

    Hope this helps!

    - Gary

  3. #3
    Join Date
    Jan 2001
    Posts
    216
    Yes, we are using sql plus.

    if I do,

    select * from userdetails; //this table has 2 rows

    It first displays all the headings for 1 row. This takes up 2 lines. Then it displays the row. This also takes up another 2 lines with lots of blank spaces in between ( as many cols are null). Then it displays the second row (2 more lines) and THEN it displays the column names again (2 more lines). Can this be compacted and trimmed out ? like display the column names first in one line and the values for the columns in 1 line each ? Because, though I have set my column size to be varchar2 (30). The value in it is only 10 chars. Can I set a default to trim those column values ? I think right now, each column is taking up as much space as specified, though the data isnt that long.

    Thanks for your help
    Neelima

  4. #4
    Join Date
    Dec 1999
    Location
    Manchester, UK
    Posts
    12

    Red face use the column format !

    Hey after doin the set lines 2000

    use this

    suppose u'r table is

    Table : emp
    Column : empno (number)
    Column : ename (varchar2)

    then type

    'Column empno format 9999999'
    'Column ename format a50'

    Now execute the query.

    This should solve the problem !
    Amit Sanghvi
    Oracle DBA
    Lex/Mastek

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width