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

charvalue A character data item.

Teradata RDBMS for UNIX SQL Reference

4-33
Teradata SQL Lexicon

Operators

Table 4-7

Operator Precedence

Precedence Result Type Operation
highest numeric + numeric (unary plus) - numeric (unary minus)
intermediate numeric numeric ** numeric (exponentiation)
numeric numeric * numeric (multiplication) numeric / numeric (division) numeric MOD numeric (modulo operator)
numeric numeric + numeric (addition) numeric - numeric (subtraction)
string concatenation operator
logical value EQ value value NE value value GT value value LE value value LT value value GE value value IN set value NOT IN set value BETWEEN value AND value charvalue LIKE charvalue
logical NOT logical
logical logical AND logical
lowest logical logical OR logical

4-34

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Lexical Separators

Lexical Separators

Introduction

A lexical separator is a character string that can be placed between words, constants, and delimiters without changing the meaning of a statement. Valid lexical separators are:

• Comments

• Blanks (several blanks are treated as a single blank, except in a string constant)

• RETURN characters (hexadecimal 0D)

Comments

The ANSI form of comment is delimited by the characters -- at the beginning of the comment and the end-of-line.

Example

SELECT EmpNo, Name FROM Payroll_Test ORDER BY Name -- Alphabetic order

Alternatively, a comment is a text string of unrestricted length that is delimited by the characters /* and */. It may begin anywhere on an input line, and may span one or more lines.

Note: This form of comment will be flagged as non-ANSI.

A comment has no effect on the processing of the statement.

The following CREATE TABLE statement illustrates the use of a comment:

CREATE TABLE Payroll_Test /* This is a test table set up to process actual payroll data on a test basis. The data generated from this table will be compared with the existing payroll system data for 2 months as a parallel test. */

(EmpNo INTEGER NOT NULL FORMAT 'ZZZZ9',

Name VARCHAR(12) NOT NULL,

DeptNo INTEGER FORMAT 'ZZZZ9',

One or more blanks are treated as a single blank, unless the blanks Blanks 4 are contained in a character string.

The value of the return character is hexadecimal 0D.

Return Character 4

Teradata RDBMS for UNIX SQL Reference

4-35
Teradata SQL Lexicon

Statement Separator

Introduction

Null Statement

Statement Separator

The semicolon is a statement separator. Each statement of a multistatement request must be separated from the subsequent statement with a semicolon.

The following multistatement request illustrates the use of the semicolon as a statement separator.

SHOW TABLE Payroll_Test ; INSERT INTO Payroll_Test (EmpNo, Name, DeptNo) VALUES ('10044', 'Jones M',

'300') ; INSERT INTO ...

When statements are entered through BTEQ a semicolon at the end of an input line terminates the request, unless that line is a comment line, beginning with two dashes. Everything to the right of the - - is a comment. In this case, the semicolon should be on the following line.

Note: The semicolon as a statement separator is non-ANSI.

A semicolon that precedes the first (or only) statement of a request is taken as a null statement. A null statement may or may not be preceded by a comment.

Here are two examples. The semicolon in the following request is a null statement:

/* This example shows a comment followed by a semicolon used as a null statement */

; UPDATE Pay_Test SET ...

The first semicolon in the following request is a null statement. The second semicolon is taken as statement separator:

/* This example shows a semicolon used as a null statement and as a statement separator */

; UPDATE Payroll_Test SET Name = 'Wedgewood A'

WHERE Name = 'Wedgewood A'

; SELECT ...

-- This example shows the use of an ANSI component -- used as a null statement and statement separator

4-36

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Lexicon

Request Terminator

Request Terminator

A request is considered complete when either the “End of Text” character or the request terminator character is detected. A semicolon is a request terminator when it is the last non-blank character on an input line in BTEQ, unless that line is a comment line beginning with two dashes. In this case, the semi-colon request terminator should be on the following line, after the comment line.

For example, on the following input line:

SELECT * FROM Employee ;

the semicolon terminates the single-statement request “SELECT * FROM Employee”.

In BTEQ, semicolons are used for terminating multistatement requests.

A request terminator is mandatory only for requests that appear in the body of a macro, or that are entered via the BTEQ interface, or other interfaces that require it.

Note: The semicolon as a request terminator is non-ANSI.
Previous << 1 .. 29 30 31 32 33 34 < 35 > 36 37 38 39 40 41 .. 241 >> Next