Name

SET NUMWIDTH

Synopsis

The NUMWIDTH setting controls the default width used when displaying numeric values.

Syntax

SET NUM[WIDTH] width

Paremeters

SET NUM[WIDTH]

Is the command, which may be abbreviated SET NUM.

width

Is the default column width used when displaying a numeric value.

Examples

The default NUMWIDTH setting is 10. NUMWIDTH is used only when no other settings apply. The following example shows the effect of setting NUMWIDTH to 5:

SQL> SET NUMWIDTH 5
SQL> SELECT 123 FROM dual;
 123
----
 123

A numeric format specified by a COLUMN command or by a SET NUMFORMAT command will override NUMWIDTH. The following example shows this:

SQL> SET NUMWIDTH 5
SQL> SET NUMFORMAT 999,999.99
SQL> SELECT 123 FROM dual;
        123
-----------
     123.00
SQL> SHOW NUMWIDTH
numwidth 5

NUMWIDTH is still five, but that value is ignored because the NUMFORMAT setting takes precedence. A long column title can cause NUMWIDTH to be ignored:

SQL> SET NUMWIDTH 5
SQL> SET NUMFORMAT ""
SQL> COLUMN a HEADING "This is a long column title"
SQL> SELECT 123 a FROM dual;
This is a long column title
---------------------------
                        123

The column title takes precedence over NUMWIDTH when it comes to determining the width of the column.

Get Oracle SQL*Plus: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.