Entering a Teradata SQL Statement - Interactive Teradata Query Facility

Interactive Teradata Query User Guide

Product
Interactive Teradata Query Facility
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
dita:id
B035-2452
lifecycle
previous
Product Category
Teradata Tools and Utilities

Entering a Teradata SQL Statement

You may enter as long a statement as you like in the input area without increasing the size of the area. For example, given an input area size of three lines, assume that you wish to enter the following Teradata SQL statement in the input area:

SELECT DeptNo, Name, Salary FROM Employee
WHERE DeptNo IN (100, 500, 600)
WITH SUM (Salary) (TITLE ’TOTAL’) BY DeptNo
ORDER BY Name;

Use the following procedure to enter this statement:

1 Erase the input area by pressing the PF17 key (assigned to the CLEAR INPUT edit command). The cursor is positioned opposite the arrow at the beginning of the input area.

2 Key the first three lines of the statement, pressing the return key on the terminal keyboard to position the cursor at the beginning of the next line. (There are now no blank lines remaining in the input area.)

3 Press ENTER to cause the first three lines of the statement to be recorded by ITEQ. ITEQ re‑displays the last line that you keyed on the first line of the input area.

4 Key the rest of your multi-line Teradata SQL statement and terminate it with a semicolon (;).

5 Press ENTER to send this last line to ITEQ. When ITEQ recognizes the semicolon as ending the statement, it submits the entire statement for processing and displays the first three lines in the input area.

If you type a Teradata SQL statement correctly and terminate it with a semicolon, ITEQ has no concern for the format in which you enter the statement. The previous statement could be typed in three lines, as follows:

==> SELECT DeptNo, Name, Salary FROM Employee
WHERE DeptNo IN (100, 500, 600)
WITH SUM (Salary) (TITLE ’TOTAL’) BY DeptNo ORDER BY Name;

Note that, even when you continue to key beyond the end of a line, ITEQ is able to accurately interpret interruptions in the statement (Dep-tNo, in the example) as long as the statement is keyed correctly.