Home > Database > Oracle > body text

How to use col in oracle

下次还敢
Release: 2024-05-02 22:57:17
Original
517 people have browsed it

The COL command is used in Oracle to change column formatting, including width, header, and alignment. The syntax is: COL . Format options include: width, header, left/right/center alignment. Other options support wrapping, truncation, even distribution, and wrapping. It should be noted that this command only affects the current session, if the column length exceeds the specified width, the data will be truncated.

How to use col in oracle

Usage of COL in Oracle

The COL command is used to change the column format in the terminal window in Oracle. It allows you to specify column width, header, and alignment.

Usage

<code>COL <列名> <格式></code>
Copy after login

Format

## Specify the format of the column, you can Includes the following options:

  • Width: Number specifying the width of the column in characters.
  • Header: String specifying the column header.
  • Alignment: Left (L), right (R) or center (C).

Example

The following example sets the width of column "Employee_Name" to 25 characters, the title "Employee Name", and left alignment:

<code>COL Employee_Name FORMAT A25 "Employee Name" LEFT</code>
Copy after login

Additional options

The COL command also supports the following additional options:

  • NEW_LINE: Inserts a Newline character.
  • TRUNC: Truncate data to fit the specified width.
  • JUSTIFY: Evenly distribute data among columns.
  • WRAPPED: Wrap data to fit the specified width.

Note

    The COL command only affects the current session.
  • If the actual length of the column exceeds the specified width, the data will be truncated.
  • For long data types (such as CLOB), the COL command only changes the display format without affecting the stored data.

The above is the detailed content of How to use col in oracle. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template