views:

116

answers:

2

Here is the way sqlplus displays my table data:

alt text

but I want to show them as

Name   |    Address    |
-------+---------------+
name1  |    address1   |
name2  |    address2   |
name3  |    address3   |
+1  A: 

I usually start with something like:

set lines 256
set trimout on
set space 1
set tab off

Have a look at help set if you have the help information installed. And then select name,address rather than select * if you really only want those two columns.

Alex Poole
+2  A: 

If you mean you want to see them like this:

WORKPLACEID NAME       ADDRESS        TELEPHONE
----------- ---------- -------------- ---------
          1 HSBC       Nugegoda Road      43434
          2 HNB Bank   Colombo Road      223423

then in SQL Plus you can set the column widths like this (for example):

column name format a10
column address format a20
column telephone format 999999999

You can also specify the line size and page size if necessary like this:

set linesize 100 pagesize 50

You do this by typing those commands into SQL Plus before running the query. Or you can put these commands and the query into a script file e.g. myscript.sql and run that. For example:

column name format a10
column address format a20
column telephone format 999999999

select name, address, telephone
from mytable;
Tony Andrews
Also we would probably want to `SET PAGESIZE 200` (say) in order to reduce the repetition of the column headings in a big resultset.
APC
so this should done during the table creation or can you please elobarate more on this
Nubkadiya
I have updated my answer
Tony Andrews