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 .. 41 42 43 44 45 46 < 47 > 48 49 50 51 52 53 .. 241 >> Next


A logical graphic string constant is allowed only under the KanjiEBCDIC character sets (others may use the hexadecimal constant equivalent). Under KanjiEBCDIC, use the following form:

G < graphic_characters >

HH01A098

Teradata RDBMS for UNIX SQL Reference

5-43
Data Definition

Japanese Character Graphic Data Types

Under a KanjiEBCDIC character set, the multibyte characters comprising the graphic string constant must be delimited with the Shift-Out/Shift-In characters; for example:

INSERT INTO TableEBCDIC (ColGRAPH)

VALUES (G'<AB>');

where AB is a valid string of KanjiEBCDIC multibyte characters.1

The size of a graphic data string is expressed in logical characters. Each logical character represents two bytes; thus, the maximum length for a GRAPHIC data type is half of the maximum length for a CHAR data type (16,000 or 32,000/2).

Japanese Character Graphic Literals

GRAPHIC[(n)] Data Type

WHEN .. . THEN . . .
the length is not specified the default is GRAPHIC(1); that is, one logical character (two bytes).
a graphic string is shorter than the specified length of the column the remaining space is filled with the graphic pad character (double byte zero).
a graphic string is longer than the specified length of the column the extra bytes are truncated.

The graphic literal G<ABC> is flagged as non-ANSI when the SQL flagger is enabled.

The GRAPHIC data type represents a fixed-length multibyte character string of length n, where n is the length in logical characters. The maximum value of n is 16,000.

The GRAPHIC data type is valid only for Japanese character supported sites. If any other site attempts to use this data type, the system generates an error message that states:

The GRAPHIC data type is not allowed for non Japanese sites.

The VARGRAPHIC data type represents a variable-length string of VARGRAPHIC(n) Data length n, where n is the length in logical characters. The maximum

Type value of n is 16,000. There is no default; omitting the length

specification results in an error.

1 bold = double byte character, G specifies the string is graphic data, and each (quote) is a single byte character.

5-44

Teradata RDBMS for UNIX SQL Reference
LONG VARGRAPHIC Data Type

Graphic Data Validation and Storage

Retrieving Graphic Data

Data Definition

Japanese Character Graphic Data Types

During data transmission between the Teradata RDBMS and the client system, a VARGRAPHIC string is prefixed with two physical bytes that indicate the length of the string.

If a graphic string is longer than the maximum specified length of the column, the extra bytes are truncated.

The LONG VARGRAPHIC data type specifies the longest permissible variable-length graphic string. It is equivalent to specifying a data type of VARGRAPHIC(16000).

Graphic data must always contain an even number of bytes. Any attempt to insert data that results in an odd number of bytes generates an error.

Graphic data is stored without translation; that is, the multibyte characters remain in the encoding of the session character set.

The Teradata RDBMS validates graphic data against the range of hexadecimal values considered valid for the character set of the current session. Hexadecimal constants cannot be validated.

Note: Because padding is provided for fixed-length graphic columns, a graphic pad character is considered a valid character.

Under all character sets, graphic data is returned to the client untranslated. The following special considerations are important in

KanjiEBCDIC.
In this mode . . . Graphic data is . . .
Record assumed to be multibyte characters and no surrounding Shift-Out/Shift-In characters are expected.
Indicator
Field treated as a character string and the data is expected to be surrounded by Shift-Out/ Shift-In characters. The Teradata RDBMS provides these characters to achieve a properly formatted result.

Teradata RDBMS for UNIX SQL Reference

5-45
Data Definition

Japanese Character Graphic Data Types

Example

457F4577456D

Under a KanjiEBCDIC session in record or indicator mode, the contents of Col1 are returned to the user as follows:

457F4577456D

Under a KanjiEBCDIC session in field mode, the contents of Col1 are returned to the user in proper format, as follows:

0E457F4 577456D0F

Assume that Col1 is defined as GRAPHIC(3) and that it contains the following data:

5-46

Teradata RDBMS for UNIX SQL Reference
Data Definition Column and Table Constraints

Column and Table Constraints

You can specify constraints on column values when the columns are Introduction defined during table creation and modification.

These constraints can be defined on single columns as a part of the column definition, or on multiple columns. The full syntax for such constraints is shown in the CREATE TABLE and ALTER TABLE sections in Chapter 8.

Column constraints include: Column Constraints primary key
Previous << 1 .. 41 42 43 44 45 46 < 47 > 48 49 50 51 52 53 .. 241 >> Next