By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,213 Members | 2,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,213 IT Pros & Developers. It's quick & easy.

Newbie with basic question about formatting

P: 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.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
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
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
Share this Question
Share on Google+
2 Replies

P: 16

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

SQL> type your query here
Aug 5 '07 #2

Expert 5K+
P: 8,127
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


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.