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 .. 27 28 29 30 31 32 < 33 > 34 35 36 37 38 39 .. 241 >> Next


Note that this may result in repeated conversions during data access. Thus, when a character field is compared with a numeric field, the character field is converted to numeric.

If a numeric field is defined and stored as a character field and a select operation requires a full table scan in comparing the character field with a numeric constant, the character field is converted to numeric in every row of the table.

The following are examples of invalid numeric constants:

12 3456789012 3456789012

$20,000.00

-38.7E2945

The first constant is invalid because it contains more than 18 digits. The second is invalid because it contains a dollar sign and a comma. The third is invalid because it contains 4 digits following the “E”.

4-26

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Character Constants

Character Constants

Character constants consist of 0 to 255 characters, delimited by a matching pair of apostrophes. A zero-length character constant is represented by two consecutive apostrophes (’’).

Note: Character constants are treated as VARCHAR(n) fields, where n is the length of the constant. As a VARCHAR field, trailing blanks can be trimmed.

The following are examples of valid character constants:

'Los Angeles'

To enter an apostrophe in a character constant, double the embedded apostrophe.

For example:

'He said ''yes'' to her question'

In a Japanese character supported site, all character data is assumed to be mixed single byte characters/multibyte characters. The maximum length for an single byte character/multibyte character string constant remains 255 bytes.

Note: A literal character string is defined as NOT CASESPECIFIC or CASESPECIFIC, depending on the mode (Teradata or ANSI) of the session parsing the string for execution. In ANSI mode, strings are CASESPECIFIC. In Teradata mode, strings are NOT CASESPECIFIC. The CASESPECIFIC attribute of character strings, determines the rules for string comparisons.

Teradata RDBMS for UNIX SQL Reference

4-27
Teradata SQL Lexicon

Hexadecimal Constants

Hexadecimal Constants

Hexadecimal string constants can consist of 0 to 255 “characters” in hexadecimal form. Hexadecimal string constants are not ANSI.

Character and byte strings are represented by an even number of hexadecimal digits. An integer is represented by an odd or even number of hexadecimal digits.

A hexadecimal digit consists of a “character” in the following set:

0 1 2 3 4 5 6 7 8 9 A B C D E F

The digits of a hexadecimal string must be enclosed in single quotes, and may have one of the following forms:

• Teradata internal form:

For characters, bytes, and integers, use:

— "hexadecimal digits(s)' — X -

C

-V-

-F-

-B

-V-

-F-

-1 --2-4-

\ Character J Options

\ Byte Options

Integer

Options

HH01A089

Note: Hexadecimal character constants inserted, are not verified for validity.

Note: An integer can be submitted only in this form, and may be represented by an odd or even number of hexadecimal digits.

• External client form:

-----X — 'hexadecimal digits' —

HH01A081

This form is taken as a client system-dependent input character string, and is mapped from the hexadecimal representation of the client system character set to the internal ASCII hexadecimal representation.

4-28

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Hexadecimal Constants

Internal ASCII Forms

Table 4-5

Hexadecimal Values Internal ASCII

Character or Byte Constants

INTEGER, BYTEINT, and SMALLINT Constants

Note that the interpretation of this form is affected by the client system-dependency feature. That is, a string in this form is assumed to be EBCDIC when submitted from a mainframe, but is assumed to be ASCII when submitted from another type of client system, or from the Teradata RDBMS console. This is true even when the session character set normally allows multibyte characters.

Valid ways to enter hexadecimal values in the internal ASCII form

are listed in Table 4-5.

Data Type Format Example
VARCHAR ’hexadecimal digits’XC or XCV ’41’XC ’41’XCV
CHAR[(n)] VARBYTE ’hexadecimal digits’XCF ’hexadecimal digits’XB or XBV ’41’XCF ’55’XB ’55’XBV
BYTE[(n)] ’hexadecimal digits’XB or XBF ’55’XBF
INTEGER ’hexadecimal digits’X or XI or XI4 ’5’X ’5’XI ’5’XI4
SMALLINT ’hexadecimal digits’XI2 ’5’XI2
BYTEINT ’hexadecimal digits’XIl ’5’XI1

The ASCII hexadecimal string is packed into bytes starting on the left. If the number of digits is odd, an implied 0 digit is added to the right. For example:

'CIC'XC = 'C1C0'XC

The ASCII hexadecimal string is right-justified in the constant. For example, the value 1000 may be expressed as:

'3e8'X or '0003e8'X or '000003e8'X

Teradata RDBMS for UNIX SQL Reference

4-29
Teradata SQL Lexicon

Hexadecimal Constants

A constant created using the XC form should be composed of values that are correct for the ASCII character set. The XC form is useful for inserting character strings such as TAB or BACKSPACE, which cannot generally be entered directly on the terminal keyboard.
Previous << 1 .. 27 28 29 30 31 32 < 33 > 34 35 36 37 38 39 .. 241 >> Next