Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Teradata RDBMS forUNIX SQL Reference - NCR

NCR Teradata RDBMS forUNIX SQL Reference - NCR, 1997. - 913 p.
Download (direct link): teradataforunix1997.pdf
Previous << 1 .. 117 118 119 120 121 122 < 123 > 124 125 126 127 128 129 .. 241 >> Next


The following example illustrates collecting statistics on an Example 4 unnamed index that includes the index definition.

COLLECT STATISTICS

ON table 1 INDEX (field 1, field 2)

8-46

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Syntax Guide

COLLECT STATISTICS

Example 5: Non-Valid Use of Named Index

Example 6: Non-Valid Use of Named Index

This statement is not valid because the index named does not exist for the table.

COLLECT STATISTICS ON table_1

INDEX no_such_index

The system returns an error message:

The specified constraint name does not exist in table.

This statement is not valid because you cannot have both an index name and an index definition in the same COLLECT STATISTICS statement.

COLLECT STATISTICS ON table_1

INDEX unique_1 (field_1, field_2)

The system returns an error message:

Only index name or index column(s) allowed in COLLECT/DROP STATISTICS.

Teradata RDBMS for UNIX SQL Reference

8-47
Teradata SQL Syntax Guide

COMMENT

Function

Syntax

COMMENT

The COMMENT statement stores or selects a description or commentary on a user-defined object (view, table, column).

COMMENT is an extension to ANSI. It is flagged when the SQL flagger is enabled.

COMMENT -

ON - DATABASE -
USER
TABLE
VIEW
MACRO
COLUMN

- objname -

-AS-

-IS-

'string'

where:

FF07A009

Syntax Element... Description
DATABASE USER TABLE VIEW MACRO COLUMN An optional, introductory keyword that describes the type of object for which the comment is stored.
objname Specifies the name of the object. A column may be a table column, a view column, or a macro parameter. If an optional keyword does not precede the object name, the object is deduced from the level of qualification in the name. That is, the unqualified name x implies COMMENT ON DATABASE x; the name x.y implies COMMENT On TABLE, VIEW, or MACRO y; and the name x.y.z implies COMMENT ON COLUMN (or macro parameter) z. The object type is not checked; use the fully-qualified name if there is any ambiguity.

8-48

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Syntax Guide

COMMENT

Syntax Element... Description
AS IS Optional keyword that introduce a clause defining a comment string.
’string’ Specifies the commentary on or description of the object name. Maximum string length is 255 characters. An existing string may be changed by specifying a new string. If no string is specified, any string previously stored is returned.

To store a comment, the user must have the DROP privilege on the Pirvileges object. If the object is a column, the DROP privilege must be on the

column’s table. No access privilege is needed to return a comment.

COMMENT is treated as a DDL statement, and as such, it cannot be Rules for Using used in 2PC mode.

COMMENT

The COMMENT statement is typically used in conjunction with a CREATE statement (except for CREATE INDEX statement), to document a newly created object.

Depending on whether a string is defined (with or without an AS or

IS keyword), entering a COMMENT statement produces the following results:

• If a string is specified, it replaces a previous string in the Data Dictionary (provided the user who specifies the string has the proper DROP privilege).

• If a string is not specified, the previous string (or, if no previous string is stored, a NULL value) is returned.

On Japanese character sites, comments can contain single byte Japanese Characters characters and/or multibyte characters from KanjiEBCDIC,

KanjiEUC, or KanjiShift-JIS character sets.

For example, the following comment, created under the KanjiEBCDIC character set, contains Latin, Katakana (0x81, 0x83 and 0x91, 0x92), and multibyte character (0x’0E454E45440F’) characters.

Note: In this example, the Katakana characters and multibyte characters are shown in hexadecimal in place of the actual characters.

THIS COMMENT IS USED FOR TABLE TAB81830E454E45440F9192

Teradata RDBMS for UNIX SQL Reference

8-49
Teradata SQL Syntax Guide

COMMENT

The following examples illustrate the use of COMMENT:

Examples

The following statement may be used to specify a description of the Example 1 Name column in the Employee table:

COMMENT ON COLUMN Employee.Name

IS 'Employee name, last name followed by first initial';

Given the following statement:

Example 2

´ COMMENT ON COLUMN Employee.Name;

the Teradata RDBMS returns:

Employee name, last name followed by first initial

8-50

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Syntax Guide

COMMIT

COMMIT

Function

In ANSI mode, the first SQL statement in a session initiates a transaction. The transaction is terminated by sending either a COMMIT, ROLLBACK, or ABORT statement, or failure causes a rollback of the transaction.

To terminate the current SQL-transaction successfully the COMMIT statement must be used.

COMMIT is valid in ANSI mode only
Previous << 1 .. 117 118 119 120 121 122 < 123 > 124 125 126 127 128 129 .. 241 >> Next