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 .. 71 72 73 74 75 76 < 77 > 78 79 80 81 82 83 .. 241 >> Next


TheSe exampleS aSSume that the String expreSSionS adhere to the KanjiEBCDIC conStraintS diScuSSed in Appendix H, “JapaneSe Character SetS,” and alSo in Appendix G, “International and JapaneSe Character Support”.

¦ VARGRAPHIC(string_expr)

string_expr Data Type Result
dEf Character dEf
gH<ABC>/ Character gHABCI (The Single byte Hankaku Katakana I iS converted to double byte I)

Teradata RDBMS for UNIX SQL Reference

6-49
SQL Expressions

String Function: CHAR2HEXINT

Introduction

Forms

Example

String Function: CHAR2HEXINT

This function is useful for obtaining the internal hexadecimal representation of names.

The CHAR2HEXINT function has the following form:

----CHAR2HEXINT---( string_expr)--

HH01A036

where string_expr must be character data. The output from CHAR2HEXINT is of type CHAR. The length of the result is twice the length of string_expr. This function converts string_expr to its internal hexadecimal representation and returns the hexadecimal values.

CHAR2HEXINT can also be applied to a quoted character string to determine what the hexadecimal equivalent would be. For this purpose, use the form:

CHAR2HEXINT('character_string');

To find the internal hexadecimal representation of all table names, you could submit the following:

SELECT

CHAR2HEXINT(TRIM(T.TableName))

(FORMAT 'X(30'))

(TITLE 'Internal Hex Representation of TableName')

, T.TableName (TITLE 'TableName')

FROM DBC.Tables T WHERE T.TableKind = 'T'

ORDER BY T.TableName;

Partial output from this statement would be similar to the following:

Internal Hex Representation of TableName TableName

416363657373 52 69676874 73 AccessRights

4163634C6F6 752 756C6 554 626C AccLogRuleTbl

4163634C6F6754626C AccLogTbl

4163636F756E7473 Accounts

4163637467 Acctg

416C6C All

436F70496E666F54626C CopInfoTbl

6-50

Teradata RDBMS for UNIX SQL Reference
Introduction

Form

Example

USing UPPER for JapaneSe CharacterS

SQL Expressions

String Function: UPPER

String Function: UPPER

The UPPER function allowS uSerS that want ANSI portability to have caSe blind compariSonS with ANSI compliant Syntax.

The UPPER function haS the following form:

----UPPER — (character_string_expr)--

HH01A040

and iS treated the Same aS the obSolete form of : expression (UPPERCASE).

CHARFIELD_1 and CHARFIELD_2 have caSeSpecific compariSon attributeS. To compare on a caSe blind baSiS;

WHERE UPPER(CHARFIELD_1) = UPPER(CHARFIELD_2);

To compare with String literal;

WHERE UPPER(CHARFIELD_1) = 'UPPER CASE STRING LITERAL';

Teradata RDBMS haS been extended to add the type attribute NOT CASESPECIFIC which allowS caSe blind compariSonS, but the type attributeS CASESPECIFIC and NOT CASESPECIFIC are non ANSI.

The uSe of UPPER to Store and return valueS iS Shown in the following example:

SELECT UPPER (last_name) FROM Names;

INSERT INTO Names SELECT UPPER(last_name),UPPER(first_name)

FROM NewNames;

or

USING (last_name CHAR(2 0),first_name CHAR(20))

INSERT INTO Names UPPER(:last_name), UPPER(:first_name);

If the type of argument for UPPER iS GRAPHIC, an error will be returned. There iS no facility for converting a GRAPHIC String to uppercaSe.

UPPER functionS for mixed Single byte character/multibyte character StringS, but not for graphic data.

Note: In thiS releaSe, only Single byte characterS are converted to uppercaSe.

Teradata RDBMS for UNIX SQL Reference

6-51
SQL Expressions

Logical Expressions

Logical Expressions

A logical expression tests an operand against one or more other operands to produce a logical (Boolean) result. An operand can be a column name, a constant, or an arithmetic expression.

The type of test performed is a function of the operator. The operators are:

• Comparison

• IN and NOT IN

• IS NULL and IS NOT NULL

• LIKE Partial-String

• Japanese character site LIKE Operator

• EXISTS

The following sections describe each operator.

6-52

Teradata RDBMS for UNIX SQL Reference
SQL Expressions

Comparison Operators

Comparison Operators

The comparison operators are listed in Table 6-13.

Introduction

Note: The results of character comparisons depends on the collation sequence of the character set in use.

Note: The ANSI operators are =, >, <, <>, <=, and >=, and BETWEEN. If you use any other operators, the statement will be flagged when the SQL flagger is enabled.

Table 6-13

Comparison Operators

Range Operator: BETWEEN

Operator Meaning
= or EQ equal
> or GT greater than
< or LT less than
ë= or NE or <> or NOT= not equal
<= or LE less than or equal to
>= or GE greater than or equal to
BETWEEN . . . AND range inclusion
NOT BETWEEN ... AND range exclusion

The form of the range operator is:

----exprl -,------,— BETWEEN — expr2 — AND— expr3---------

Lnot-I

HH01A038

The BETWEEN test is satisfied if the following condition is true:

expr2 <= exprl <= expr3
Previous << 1 .. 71 72 73 74 75 76 < 77 > 78 79 80 81 82 83 .. 241 >> Next