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
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!
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
use the column format !
Hey after doin the set lines 2000
suppose u'r table is
Table : emp
Column : empno (number)
Column : ename (varchar2)
'Column empno format 9999999'
'Column ename format a50'
Now execute the query.
This should solve the problem !