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


Note that you cannot use keywords to name database objects. Because new keywords are frequently added to new releases of the Teradata RDBMS, you may experience a problem with database object names that were valid in prior releases but which become nonvalid in a new release.

The workaround for this is to do one of the following things:

Put the newly nonvalid name in double quotes.

Rename the object

In either case you must change your applications.

Teradata RDBMS for UNIX SQL Reference

4-21
Teradata SQL Lexicon

Delimiters

Introduction

Example

Delimiters

Delimiters are special characters whose meaning depends on context. Teradata SQL delimiters are:

The function of each delimiter is described in Table 4-4.

In the following statement, the period separates the database name (Examp and Personnel) from the table name (Profile and Employee), and, where reference is qualified to avoid ambiguity, it separates the table name (Profile, Employee) from the column name (DeptNo).

UPDATE Examp.Profile SET FinGrad = 'A'

WHERE Name = 'Phan A' ; SELECT EdLev, FinGrad,JobTitle,

YrsExp FROM Examp.Profile, Personnel.Employee WHERE Profile.DeptNo = Employee.DeptNo ;

The first semicolon separates the UPDATE statement from the SELECT statement. The second semicolon terminates the entire multistatement request.

Note: The semicolon is not a delimiter in ANSI SQL. It is used in Teradata SQL only to separate multiple statements, either in a request or macro definition, or to terminate a request for requests submitted through BTEQ.

4-22

Teradata RDBMS for UNIX SQL Reference
Table 4-4

Delimiters in Teradata SQL

Teradata SQL Lexicon

Delimiters

Delimiter Function
() (parentheses) Group expressions and define the limits of various phrases.
, (comma ) Separates items in a list, or as a date separator.
: (colon) Prefixes a referenced parameter or client system variable; also used as a date separator.
. (period) Separates a database name from a table name, or a table name from a column name. In numeric constants, the period is the decimal point. The period is also used as a date separator.
; (semicolon) Separates statements in a request. In BTEQ, a semicolon at the end of an input line, terminates a request.
(apostrophe) Defines the boundaries of character string constants; also used as a date separator.
(quote mark) Defines the boundaries of nonstandard names.
@ (at sign) Obsolete; replaced by : (colon)
/ Slash; used as a date separator.
B Blank; used as a date separator.
- Dash; used as a date separator.

Teradata RDBMS for UNIX SQL Reference

4-23
Teradata SQL Lexicon

Constants

Introduction

Constants

A constant is a literal string or value embedded in a Teradata SQL statement. A constant may be of the type date, character, numeric, or string.

On a Japanese character supported site, sessions using the KanjiEBCDIC character set also can express a graphic string constant. Other character sets can express a graphic literal in hexadecimal.

4-24

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Numeric Constants

Introduction

Converting Numeric Constants

Numeric Constants

Numeric constants may have the following forms:

Integer, Smallint, and Byteint

Decimal (Numeric)

Floating point (Real, Double Precision)

Note: The Numeric constant has been implemented to function like the Decimal constant. Real and Double Precision have been implemented to function like the Floating point constant.

The following are examples of valid numeric constants:

Byteint Smallint Integer Decimal Floating Point
127 32767 32768 0.0 1E1
-36 -12000 -60400 -235. 1.4E6
-128 -32768 2147483647 2147483650 18E-3

The difference between Byteint, Smallint, and Integer is the range of values allowed and the internal storage size. A Byteint occupies 1 byte, Smallint 2 bytes, and Integer 4 bytes. Valid ranges for these

numeric constants are as follows:
Numeric Constant Low High
BYTEINT -128 127
SMALLINT -32768 32767
INTEGER -2147483648 2147483647

Depending on the kind of operation performed or the type of column in which a value is to be stored, SQL may convert literal constants from one numeric data type to another, or convert character strings that represent numeric values to a numeric data type.

If a constant is outside the range for a required type, an error is reported during conversion. An error also is reported if a character string that is assigned to a numeric field does not represent a valid numeric value.

Teradata RDBMS for UNIX SQL Reference

4-25
Teradata SQL Lexicon

Numeric Constants

Converting Character Strings to Numeric Constants

Non-Valid Numeric Constants: Examples

A character string may contain a value that is intended to be a numeric value (for example, 15). In such cases, the Teradata RDBMS attempts to convert the string to a numeric value whenever a numeric value is required in the context.
Previous << 1 .. 26 27 28 29 30 31 < 32 > 33 34 35 36 37 38 .. 241 >> Next