SET WIDTH
Normally the width of a character column in a table defines the width of the output when that column is selected.Using the set width command allows the user to define a wider or narrower output column width.
The format of the command is:
SET WIDTH column_or_alias [width]
The setting remains until changed to a new width, or until cancelled by the set width column_or_alias command;no width supplied means use the default width setting for this column.
The following example shows the width of the last_name column being amended.The first SELECT shows the default setting which is a width of 20 characters (count the '=' in the headings) which is the definition of the last_name column in the employee table.The second shows the width being reduced to 10 characters.
SQL> select first 10 emp_no, last_name
CON> from employee
CON> order by last_name;
EMP_NO LAST_NAME
======= ====================
34 Baldwin
105 Bender
28 Bennet
83 Bishop
109 Brown
SQL> set width last_name 10;
SQL> select first 10 emp_no, last_name
CON> from employee
CON> order by last_name;
EMP_NO LAST_NAME
======= ==========
34 Baldwin
105 Bender
28 Bennet
83 Bishop
109 Brown
EMP_NO is a smallint data type.Unfortunately, it’s not possible to change the width on non-character columns like integer, smallint etc.The set width emp_no 10; command, for example, has no effect, as shown below, which also demonstrates turning off a previous width setting for the last_name column:
SQL> set width last_name;
SQL> set width emp_no 10;
SQL> select first 10 emp_no, last_name
CON> from employee
CON> order by last_name;
EMP_NO LAST_NAME
======= ====================
34 Baldwin
105 Bender
28 Bennet
83 Bishop
109 Brown