DisibioAaron
DisibioAaron

Reputation: 1373

oracle How do I remove blank characters in column names? (or limit them?)

I am working on my homework assignment which invloves writing sql code for oracle (version 11 I believe).

So I write the proper select statement but the formatting is just unreadable.

I just can't find out how to lower spaces to the longest name, or to limit the amount of characters draw.

ORDER_ID CUSTOMER_ID CUSTOMER_NAME
---------- ----------- ----------------------------------------
CUSTOMER_ADDRESS
--------------------------------------------------------------------------------

CUSTOMER_CITY                  CU
------------------------------ --
       103          81 Sharon's Thrift Shop
5122 Alvin Heights
Austin                         TX

       104          81 Sharon's Thrift Shop

etc

I understand its because my VarChar2 is very long, but thats how he wants it. (well he said add plenty of room for growth)

I found things like set pagesize and set lin , which I did get it to look ok but then it didn't draw the column name at all or made it too short and didnt help

set lin 20; returned

ORDER_ID
----------
CUSTOMER_ID
-----------
CUSTOMER_NAME
--------------------
CUSTOMER_ADDRESS
--------------------
CUSTOMER_CITY
--------------------
CU
--
        39
         33
Widget Resellers, In
c.
743 Evergreen Terrac
e
Springfield
MO

I am not 100% sure what to search for and most were not even relavent to my question. I am very new to oracle sql (and sql in general). I would think this would be pretty common, and I would think there is a simple soultion, but I am not able to find it. Any help?

if its relevent my select statement is

SELECT orders.order_id, customers* FROM orders,customers;

As with any homework assignment, I want to understand the problem (and soultion) and I don't want just the answer.

Thanks for your time.

Upvotes: 0

Views: 329

Answers (1)

Kirill Leontev
Kirill Leontev

Reputation: 10941

If all your question is about formatting your correct output in sql*plus, then it would be

column order_id format a8 
column customer_address format a15 

etc.

http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch6.htm#i1081036

http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12013.htm#BACHCABF

Upvotes: 7

Related Questions