468,107 Members | 1,470 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

Newbie with basic question about formatting

1
Here is my query:

Expand|Select|Wrap|Line Numbers
  1. SELECT departments.department_name AS "Department name", locations.STREET_ADDRESS AS "Mailing address", locations.city, locations.state_province, locations.postal_code
  2. FROM departments, locations
  3. WHERE departments.location_id = locations.location_id
  4. AND locations.country_id = 'US'
  5. ORDER BY department_name;
and here is what the output is like:

Expand|Select|Wrap|Line Numbers
  1. Department name                Mailing address
  2. ------------------------------ ----------------------------------------
  3. CITY                           STATE_PROVINCE            POSTAL_CODE
  4. ------------------------------ ------------------------- ------------
  5. Administration                 2004 Charade Rd
  6. Seattle                        Washington                98199
  7. IT                            2014 Jabberwocky Rd
  8. Southlake                      Texas                     26192
  9.  
  10.  
my query needs to list department names and mailing addresses of the departments located in the U.S. My current query accomplishes the result fine but the formatting is wrong because I need it to look like this (it's an sql excercise, I'm a newbie):

Expand|Select|Wrap|Line Numbers
  1. Department Name                Mailing Address
  2. ----------------------                -----------------------------------------------------
  3. Administration                     2004 Charade Rd, Seattle, Washington 98199
  4. IT                                2014 Jabberwocky Rd, Southlake, Texas 26192
  5.  
How can I do this?

Thanks for your time.

PS: it doesn't matter if the displayed data is folded because of the number of lines allowed.
Aug 5 '07 #1
2 965
Mala232
16
Hi,

Use set linesize 100 or more number to fit in the screen

SQL> SET LINESIZE 100;
SQL> type your query here
Aug 5 '07 #2
debasisdas
8,127 Expert 4TB
SQL*PLUS has some default setting , as per that it can display 80 chars per line and 14 lines per page . After the specified value the display will move to next line / page. to change the default values

ex
--------

set line 120

(maximun 32767)

set pages 50
(maximum 50000)

u can also do the same from the menu by changing the environment variables.
Aug 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Markus Pitha | last post: by
reply views Thread by Rauf Sarwar | last post: by
24 posts views Thread by cplxphil | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.