Sqlplus Command use Guide (ii) enhydraboy (original)

Source: Internet
Author: User
Tags variables sqlplus


Keyword sqlplus command usage guide


/*------------------------------------------------------------------------------------

/* Welcome reprint, please keep this part of the information

/* Ongyan 2004-1-15

/*------------------------------------------------------------------------------------

Five report making orders

Report making commands are the most important sql*plus commands that are often used by DBAs. Here, let me briefly explain.

(1) Ttitle command

Place the title of a report.

Grammar:

Ttitle

------



Places and formats a title at the top of each page.

Enter ttitle with no clause to list it current definition.



The old form of Ttitle was used if only a single word or

A string in quotes follows the Ttitle command.



Tti[tle] [Printspec [text|variable] ...] | [on| OFF]



Where Printspec is one or more of the following clauses:



COL N le[ft] BOLD

S[kip] [n] ce[nter] FORMAT text

tab N R[ight]

Description of the main parameters:

¨ the position in which the report title appears, with Left,center decision

¨ can also use the user's variables (the content is maintained by the system), such as the Sql.pno page number, SQL. Lno line number and so on

¨col[n] is the title displayed at the beginning of the first few character positions.



(2) Column command

The main purpose of this command is the output format of the results of the canonical query. The output format includes a number and can specify the width of the display. Column setting, it remains in effect. Unless you use column to set it up or use column <column name> clear.

Grammar:

COLUMN

------



Specifies display attributes for a given column, such as:

-Column Heading text

-Column Heading Alignment

-Number data format

-Column Data Wrapping



Also lists the current display attributes for a single column

or all columns.



Col[umn] [{column | expr} [option ...]]



Where option is one of the following clauses:

Ali[as] Alias

Cle[ar]

Entmap {on| OFF}

Fold_a[fter]

Fold_b[efore]

For[mat] Format

Hea[ding] Text

Jus[tify] {L[eft] | C[enter] | C[entre] | R[ight]}

like {expr | alias}

Newl[ine]

New_v[alue] Variable

NOPRI[NT] | PRI[NT]

Nul[l] Text

Old_v[alue] Variable

on| Off

Wra[pped] | Wor[d_wrapped] | Tru[ncated]



Here's an example:

sql> COLUMN SAL ALIAS Salary FORMAT $99,990.90

We've specified Sal. An alias and a digital display format for this column, and the following display shows the effect of the setting.

Figure 1

Tips on Format:

¨ a variety of text settings, with A[n] to represent, n represents the length of the display. Then the display length of this text column is in the width of N characters, if the content is >n, it will automatically change careers. As shown in Figure 2

¨ date format, sqlplus the default date format displayed according to Nls_lang settings. The default is A9. You can then either set the database startup parameters, or sqlplus the environment variables, or use the alter session command to standardize the display of the date, or you can convert the display by To_char, or you can use the column command to specify the display length.

¨ number format, indicating some commonly used symbols. As shown in Figure 3

9 represents a numeric character

0 Displays leading 0 or 0 at the specified position

$ Dollar currency symbol

B shows an empty, if it's 0.

MI shows minus sign, if less than 0

, displaying the thousand-bit separator

. Show decimal point

G and, like, display the thousand-digit grouping symbol

L Displays the currency symbol for the local area

Figure 2



Figure 3

Tips on other parameters

Justify mainly specify the alignment of column display content. Left, Right,center.

Like to specify that the display of this column refer to the display method of one of the other columns. such as: COLUMN COMM like SAL

NEW line newline shows the contents of this column

Null text, if it is null, displays a string equivalent to the IsNull function.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.