标签:
SQL> select * from v$version where rownum=1;The default width of CHAR, NCHAR, VARCHAR2 (VARCHAR) and NVARCHAR2 (NCHAR VARYING) columns is the width of the column in the database. SQL*Plus formats these datatypes left-justified. If a value does not fit within the column width, SQL*Plus wraps or truncates the character string depending on the setting of SET WRAP.
A LONG, BLOB, BFILE, CLOB, NCLOB or XMLType column‘s width defaults to the value of SET LONGCHUNKSIZE or SET LONG, whichever one is smaller.
SQL*Plus truncates or wraps XMLType columns after 2000 bytes. To avoid this you need to set an explicit COLUMN format for the XMLType column. A COLUMN format can be up to a maximum of 60000 per row.
To change the width of a datatype to n, use FORMAT An. (A stands for alphabetic.) If you specify a width shorter than the column heading, SQL*Plus truncates the heading.
DATE ColumnsThe default width and format of unformatted DATE columns in SQL*Plus is derived from the NLS_DATE_FORMAT parameter. The NLS_DATE_FORMAT setting is determined by the NLS territory parameter. For example, the default format for the NLS territory, America, is DD-Mon-RR, and the default width is A9. The NLS parameters may be set in your database parameter file, in environment variables or an equivalent platform-specific mechanism. They may also be specified for each session with the ALTER SESSION command. For more information about DATE formats, and about NLS parameters, see the Oracle Database SQL Language Reference.
You can change the format of any DATE column using the SQL function TO_CHAR in your SQL SELECT statement. You may also wish to use an explicit COLUMN FORMAT command to adjust the column width.
When you use SQL functions like TO_CHAR, Oracle Database automatically enables a very wide column. The default column width may also depend on the character sets in use in SQL*Plus and in the database. To maximize script portability if multiple characters sets are used, Oracle Database recommends using COLUMN FORMAT for each column selected.
To change the width of a DATE column to n, use the COLUMN command with FORMAT An. If you specify a width shorter than the column heading, the heading is truncated.
NUMBER Columns For numeric columns, COLUMN FORMAT settings take precedence over SET NUMFORMAT settings, which take precedence over SET NUMWIDTH settings.
See SET NUMF[ORMAT] format and SET NUM[WIDTH] {10 | n}.
To change a NUMBER column‘s width, use FORMAT followed by an element as specified in Table 12-1, "Number Formats".
Element | Examples | Description |
---|---|---|
, (comma) |
9,999 |
Displays a comma in the specified position. |
. (period) |
99.99 |
Displays a period (decimal point) to separate the integral and fractional parts of a number. |
$ |
$9999 |
Displays a leading dollar sign. |
0 |
0999 9990 |
Displays leading zeros Displays trailing zeros. |
9 |
9999 |
Displays a value with the number of digits specified by the number of 9s. Value has a leading space if positive, a leading minus sign if negative. Blanks are displayed for leading zeroes. A zero (0) is displayed for a value of zero. |
B |
B9999 |
Displays blanks for the integer part of a fixed-point number when the integer part is zero, regardless of zeros in the format model. |
C |
C999 |
Displays the ISO currency symbol in the specified position. |
D |
99D99 |
Displays the decimal character to separate the integral and fractional parts of a number. |
EEEE |
9.999EEEE |
Displays value in scientific notation (format must contain exactly four "E"s). |
G |
9G999 |
Displays the group separator in the specified positions in the integral part of a number. |
L |
L999 |
Displays the local currency symbol in the specified position. |
MI |
9999MI |
Displays a trailing minus sign after a negative value. Display a trailing space after a positive value. |
PR |
9999PR |
Displays a negative value in <angle brackets>. Displays a positive value with a leading and trailing space. |
RN rn |
RN rn |
Displays uppercase Roman numerals. Displays lowercase Roman numerals. Value can be an integer between 1 and 3999. |
S |
S9999 9999S |
Displays a leading minus or plus sign. Displays a trailing minus or plus sign. |
TM |
TM |
Displays the smallest number of decimal characters possible. The default is TM9. Fixed notation is used for output up to 64 characters, scientific notation for more than 64 characters. Cannot precede TM with any other element. TM can only be followed by a single 9 or E |
U |
U9999 |
Displays the dual currency symbol in the specified position. |
V |
999V99 |
Displays value multiplied by 10n, where n is the number of 9‘s after the V. |
X |
XXXX xxxx |
Displays the hexadecimal value for the rounded value of the specified number of digits. |
标签:
原文地址:http://blog.csdn.net/bat_os/article/details/46346649