Teradata RDBMS forUNIX SQL Reference - NCR

For example, if data is represented on the client system in EBCDIC and a user’s terminal keyboard does not include the brace characters {}, the data “{12}” could be represented in ASCII hexadecimal as:

'7B31327D'XC

where 7B and 7D represent { and }, respectively.

XB is the only form for entering a byte string in internal ASCII from the keyboard. For example, suppose the column CodeVal has been defined as BYTE(4). To insert the characters “xy” as an ASCII hexadecimal string, use the form:

... (CodeVal) VALUES ('7879'XB) ;

To select those rows from CodeVal, specify the conditional as:

... WHERE CodeVal = '78790000'XB ;

_ _ To enter a byte string in EBCDIC hexadecimal from a mainframe,

Byte String in EBCDIC use the X’hexadecimal digits’ form.

Hexadecimal

For example:

... (CodeVal) VALUES (X'A7A8') ;

... WHERE CodeVal = X'A7A80000' ;

Note: Interpretation of the external client form is dependent on the client system. If this form is submitted from an ASCII client system or the Teradata RDBMS console, the string is taken as internal ASCII hexadecimal.

For example, an input of X’60’ from an ASCII system dumped to an EBCDIC client system will not be 60H.

On a Japanese character supported site, the hexadecimal representation can be used to define a graphic string constant under any character set. (Note that if the character set is KanjiEBCDIC, the Shift-Out and Shift-In characters must be omitted.)

A graphic hexadecimal constant can be only to a column defined as a GRAPHIC or VARGRAPHIC data type.

Constants Using XB

Constant Created Using XC

4-30

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Hexadecimal Constants

Under all character sets, use the following form to define a graphic hexadecimal constant:

----'hexadecimal_digits' XG -

-V — -F-

HH01A078

where:

Syntax Element ... Description
’ hexadecimal_digits’ The quoted hexadecimal representation (in the client encoding) of the multibyte character string. Note that the string must equate to an even multiple of bytes Each quote mark ( ’ ) is a single byte character.
XG The letters XG specify a hexadecimal graphic constant.
F V The letters XG can be appended by the letter F (for a fixed-length string) or V (for a variable-length string).

On a Japanese character site, graphic string constants can be used if a KanjiEBCDIC character set is in effect for the session. (For other character sets, you can use the hexadecimal representation of the graphic string.)

Note: Graphic constants are flagged as non ANSI, when the SQL flagger is enabled.

Note that the Shift-Out/Shift-In characters are not included in the byte count and are not stored as part of the graphic constant.

• The contents must be valid graphic data (multibyte characters that are printable under the KanjiEBCDIC character set in effect for the current session).

• The internal representation must be an even number of bytes.

4-32

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Operators

Operators

Operators are used to express logical and arithmetic operations. Operators of the same precedence are evaluated from left to right.

Parentheses can be used to control the order of precedence. When parentheses are present, operations are performed from the innermost set of parentheses outward.

SQL operations, and the order in which they are performed when no parentheses are present, are listed in Table 4-7. The following definitions apply to Table 4-3:

Term Definition
numeric Any constant, data reference, or expression having a numeric value.
string Any character string or string expression.
logical A Boolean expression (resolves to true or false).
value Any numeric, character, or byte data item.
set A collection of values returned by a subquery, or a list of values separated by commas and enclosed by parentheses.