interactive teradata query reference - anatella interactive... · 8 interactive teradata query...
TRANSCRIPT
Interactive Teradata QueryReference
Release 14.10B035-2451-082K
March 2013
The product or products described in this book are licensed products of Teradata Corporation or its affiliates.
Teradata, Active Enterprise Intelligence, Applications-Within, Aprimo, Aprimo Marketing Studio, Aster, BYNET, Claraview, DecisionCast, Gridscale, MyCommerce, Raising Intelligence, Smarter. Faster. Wins., SQL-MapReduce, Teradata Decision Experts, "Teradata Labs" logo, "Teradata Raising Intelligence" logo, Teradata ServiceConnect, Teradata Source Experts, "Teradata The Best Decision Possible" logo, The Best Decision Possible, WebAnalyst, and Xkoto are trademarks or registered trademarks of Teradata Corporation or its affiliates in the United States and other countries.Adaptec and SCSISelect are trademarks or registered trademarks of Adaptec, Inc.AMD Opteron and Opteron are trademarks of Advanced Micro Devices, Inc.Apache, Apache Hadoop, Hadoop, and the yellow elephant logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.Axeda is a registered trademark of Axeda Corporation. Axeda Agents, Axeda Applications, Axeda Policy Manager, Axeda Enterprise, Axeda Access, Axeda Software Management, Axeda Service, Axeda ServiceLink, and Firewall-Friendly are trademarks and Maximum Results and Maximum Support are servicemarks of Axeda Corporation.Data Domain, EMC, PowerPath, SRDF, and Symmetrix are registered trademarks of EMC Corporation.GoldenGate is a trademark of Oracle.Hewlett-Packard and HP are registered trademarks of Hewlett-Packard Company.Hortonworks, the Hortonworks logo and other Hortonworks trademarks are trademarks of Hortonworks Inc. in the United States and other countries.Intel, Pentium, and XEON are registered trademarks of Intel Corporation.IBM, CICS, RACF, Tivoli, and z/OS are registered trademarks of International Business Machines Corporation.Linux is a registered trademark of Linus Torvalds.LSI is a registered trademark of LSI Corporation.Microsoft, Active Directory, Windows, Windows NT, and Windows Server are registered trademarks of Microsoft Corporation in the United States and other countries.NetVault is a trademark or registered trademark of Quest Software, Inc. in the United States and/or other countries.Novell and SUSE are registered trademarks of Novell, Inc., in the United States and other countries.Oracle, Java, and Solaris are registered trademarks of Oracle and/or its affiliates.QLogic and SANbox are trademarks or registered trademarks of QLogic Corporation.Red Hat is a trademark of Red Hat, Inc., registered in the U.S. and other countries. Used under license.SAS and SAS/C are trademarks or registered trademarks of SAS Institute Inc.SPARC is a registered trademark of SPARC International, Inc.Symantec, NetBackup, and VERITAS are trademarks or registered trademarks of Symantec Corporation or its affiliates in the United States and other countries.Unicode is a registered trademark of Unicode, Inc. in the United States and other countries.UNIX is a registered trademark of The Open Group in the United States and other countries.Other product and company names mentioned herein may be the trademarks of their respective owners.
THE INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED ON AN "AS-IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY NOT APPLY TO YOU. IN NO EVENT WILL TERADATA CORPORATION BE LIABLE FOR ANY INDIRECT, DIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS OR LOST SAVINGS, EVEN IF EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
The information contained in this document may contain references or cross-references to features, functions, products, or services that are not announced or available in your country. Such references do not imply that Teradata Corporation intends to announce such features, functions, products, or services in your country. Please consult your local Teradata Corporation representative for those features, functions, products, or services available in your country.Information contained in this document may contain technical inaccuracies or typographical errors. Information may be changed or updated without notice. Teradata Corporation may also make improvements or changes in the products or services described in this information at any time without notice.To maintain the quality of our products and services, we would like your comments on the accuracy, clarity, organization, and value of this document. Please email: [email protected]. Any comments or materials (collectively referred to as "Feedback") sent to Teradata Corporation will be deemed non-confidential. Teradata Corporation will have no obligation of any kind with respect to Feedback and will be free to use, reproduce, disclose, exhibit, display, transform, create derivative works of, and distribute the Feedback and derivative works thereof without limitation on a royalty-free basis. Further, Teradata Corporation will be free to use any ideas, concepts, know-how, or techniques contained in such Feedback for any purpose whatsoever, including developing, manufacturing, or marketing products or services incorporating Feedback.
Copyright © 2000-2013 by Teradata Corporation. All Rights Reserved.
Interactive Teradata Query Reference 3
Preface
Purpose
This book provides information about Interactive Teradata Query Facility (ITEQ), which is a Teradata® Tools and Utilities product. This book provides information about using the ITEQ command language. Teradata Tools and Utilities is a group of products designed to work with Teradata Database.
Audience
This book is intended for use by:
• Users who interface with the Teradata Database
Supported Releases
This book supports the following releases:
• Teradata Database 14.10
• Teradata Tools and Utilities 14.10
• IMS/DC 14.10
To locate detailed supported-release information:
1 Go to http://www.info.teradata.com/.
2 Under Online Publications, click General Search.
3 Type 3119 in the Publication Product ID box.
4 Under Sort By, select Date.
5 Click Search.
6 Open the version of the Teradata Tools and Utilities ##.##.## Supported Platforms and Product Versions spreadsheet associated with this release.
The spreadsheet includes supported Teradata Database versions, platforms, and product release numbers.
PrefacePrerequisites
4 Interactive Teradata Query Reference
Prerequisites
The following prerequisite knowledge is required for this product:
• Teradata Database
• Teradata SQL concepts and terminology
Changes to This Book
The following changes were made to this book in support of the current release. Changes are marked with change bars. For a complete list of changes to the product, see the Teradata Tools and Utilities Release Definition associated with this release.
Additional Information
Additional information that supports this product and Teradata Tools and Utilities is available at the web sites listed in the table that follows.
Date and Release Description
March 201314.10
Updated versions and copyright date.
There are no documentation changes resulting from this release.
Type of Information Description Access to Information
Release overview
Late information
Use the Release Definition for the following information:
• Overview of all of the products in the release
• Information received too late to be included in the manuals
• Operating systems and Teradata Database versions that are certified to work with each product
• Version numbers of each product and the documentation for each product
• Information about available training and the support center
1 Go to http://www.info.teradata.com/.
2 Under Online Publications, click General Search.
3 Type 2029 in the Publication Product ID box.
4 Click Search.
5 Select the appropriate Release Definition from the search results.
PrefaceAdditional Information
Interactive Teradata Query Reference 5
Additional product information
Use the Teradata Information Products web site to view or download specific manuals that supply related or additional information to this manual.
1 Go to http://www.info.teradata.com/.
2 Under the Online Publications subcategory, Browse by Category, click Data Warehousing.
3 Do one of the following:
• For a list of Teradata Tools and Utilities documents, click Teradata Tools and Utilities, and then select an item under Releases or Products.
• Select a link to any of the data warehousing publications categories listed.
Other books related to ITEQ are:
• Interactive Teradata Query User GuideB035-2452
CD-ROM images Access a link to a downloadable CD-ROM image of all customer documentation for this release. Customers are authorized to create CD-ROMs for their use from this image.
1 Go to http://www.info.teradata.com/.
2 Under the Online Publications subcategory, Browse by Category, click Data Warehousing.
3 Click CD-ROM Images.
4 Follow the ordering instructions.
Ordering information for manuals
Use the Teradata Information Products web site to order printed versions of manuals.
1 Go to http://www.info.teradata.com/.
2 Under Print & CD Publications, click How to Order.
3 Follow the ordering instructions.
General information about Teradata
The Teradata home page provides links to numerous sources of information about Teradata. Links include:
• Executive reports, case studies of customer experiences with Teradata, and thought leadership
• Technical information, solutions, and expert advice
• Press releases, mentions, and media resources
1 Go to www.teradata.com.
2 Select a link.
Type of Information Description Access to Information
PrefaceAdditional Information
6 Interactive Teradata Query Reference
Interactive Teradata Query Reference 7
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Supported Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Changes to This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Chapter 1: ITEQ Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Hardware and Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Logging On and Off . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
In-Session Logons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Interrupting a Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Default Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Print and Disk File Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Terminal Screen Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Screen Format. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Chapter 2: ITEQ Commands and Teradata SQL Statements . . . . . . . . . . . . . . . 23
Entering Commands and Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
ITEQ Edit Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Input Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Display Area. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Examining Teradata SQL Statement Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Data-Generating Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
ITEQ Display Control Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
ITEQ Format Specification Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
ITEQ System Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table of Contents
8 Interactive Teradata Query Reference
ITEQ Reference Display Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
Program Function Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Using Macros in ITEQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
Interrupting Statement Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31
Aborting a Statement. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31
Chapter 3: ITEQ Command Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
ABORT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
ADD Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
BACKWARD Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
CANCEL Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
CLEAR INPUT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
DOWN Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
FILE Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
FORWARD Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39
Table of Contents
Interactive Teradata Query Reference 9
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
INPUT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
JOIN Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
LEFT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
LOGOFF Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
LOGON Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
PRINT Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
QUIT Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
RECALL COMMAND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
REMARK Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
REMOVE Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
RIGHT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Table of Contents
10 Interactive Teradata Query Reference
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .47
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
SET DEFAULTS Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49
SET FORMAT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .49
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
SET INPUTAREA SIZE Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
SET NULL AS Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51
SET PAGELENGTH Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
SET PROGRAM FUNCTION KEY Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52
Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
SET RETLIMIT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
SET RTITLE Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
SET SESSION CHARSET Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
SET SUPPRESS Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57
Table of Contents
Interactive Teradata Query Reference 11
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
SET WIDTH Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
SHOW Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
SHOW CONTROL Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
SHOW MACRO VIEW or TABLE Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
SPLIT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
SUBMIT Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
UP Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Usage Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Table of Contents
12 Interactive Teradata Query Reference
Appendix A: ITEQ Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
Appendix B: Notation Convention. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .67
Appendix C: Sample Personnel Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71
Interactive Teradata Query Reference 13
List of Figures
Figure 1: 1ITEQ Screen Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
List of Figures
14 Interactive Teradata Query Reference
Interactive Teradata Query Reference 15
List of Tables
Table 1: ITEQ Status and System Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Table 2: ITEQ Edit Control Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Table 3: ITEQ Display Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 4: ITEQ Format Specification Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 5: ITEQ System Control Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 6: IITEQ Reference Display Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 7: Default PF Key Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 8: Format Command Defaults. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Table 9: Default PF Key Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Table 10: Default ITEQ Format Control Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Table 11: ITEQ Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Table 12: Format Notations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
List of Tables
16 Interactive Teradata Query Reference
Interactive Teradata Query Reference 17
CHAPTER 1
ITEQ Concepts
The Interactive Teradata Query facility (ITEQ) is used to process Teradata SQL statements interactively. ITEQ provides a user-friendly interface to the Teradata Database System (Teradata DBS). It includes extensions to Teradata SQL that allow a user at a terminal that is attached to a client computer to interact directly with the Teradata DBS without having to develop application software.
Hardware and Software Requirements
ITEQ operates on IBM (or IBM-compatible) processors that support the MVS/370 and/or the MVS/XA architecture. ITEQ operates under the following operating systems:
• MVS/TSO
• VM/CMS
In the MVS environment, ITEQ requires MVS Level 3.8 or higher with the Time Sharing Option (TSO). Both VTAM (System Network Architecture, SNA, and non-SNA) and TCAM access methods are supported.
In the VM/CMS environment, ITEQ requires Level 3.0 or higher. Access methods supported include native terminal attachment, VM PASSTHRU, and VTAM/VCNA (SNA or non-SNA).
In both the MVS/TSO and VM/CMS environments, ITEQ terminal communication is in full screen mode. ITEQ sends and receives formatted 3270 data streams. ITEQ does not support SCS (SNA Character String) or SFAP (Structured Field and Attribute Processing).
ITEQ supports IBM or IBM-compatible 3270 Information Display System devices with a screen size of at least 12 lines of 40 characters each. This includes the IBM 3275, 3276, 3277, 3278, and 3279 terminals in both local and remote configurations.
ITEQ determines the screen size of a terminal internally and formats output accordingly. Output can be directed to the changed data sets to files terminal screen and/or to external files.
ITEQ allows a user to:
• Enter Teradata SQL statements
A user can enter and execute a Teradata SQL statement at a terminal. If the result of statement execution is unsatisfactory, the user can conveniently modify the statement without re-entering it.
Chapter 1: ITEQ ConceptsLogging On and Off
18 Interactive Teradata Query Reference
• View results
A user can browse through the result of a Teradata SQL statement, moving the screen horizontally or vertically over a result that exceeds the size of a single display.
• Format data and reports
A user can easily format the result of a query for display on a terminal screen, for printing on a hardcopy device, or storing on a disk file.
• Execute macros
A user can define and execute macros that contain one or several statements and ITEQ commands.
• Control terminal operation
A user can define the use of program function (PF) keys on the terminal keyboard and adjust the format of information displayed on the screen.
• Display and modify reference information
A user can:
• Display Data Dictionary/Directory views.
• Modify and replace view and macro definitions.
• View and modify the last executed Teradata SQL statement.
• View ITEQ controls currently in effect.
Logging On and Off
An ITEQ session can be initiated by a user at a terminal that is logged on to the client operating system via an interactive subsystem supported by ITEQ (MVS/TSO or VM/SP CMS). Teradata provides a CLIST (for TSO) or an EXEC (for VM/SP) that can be used to invoke ITEQ. ITEQ then formats the screen. After logging on, the user can enter and submit ITEQ commands and Teradata SQL statements.
If the result of statement execution is unsatisfactory, the statement may be modified and resubmitted until the desired result is produced. All Teradata SQL statements are available to the ITEQ user except:
• DUMP
• RESTORE
To log on to ITEQ, the user must first:
• Log on to the appropriate interactive client subsystem, using the logon procedure for that subsystem.
• Invoke ITEQ.
To log off the current session without terminating ITEQ, the user enters the LOGOFF command.
To log off the current session and terminate ITEQ (returning control of the terminal to TSO or CMS), the user enters the QUIT command.
Chapter 1: ITEQ ConceptsDefault Settings
Interactive Teradata Query Reference 19
See the descriptions of the LOGON, LOGOFF, and QUIT commands in Chapter 3 for detailed information.
In-Session Logons
Without exiting ITEQ, a user may:
• Log off an existing ITEQ session with the LOGOFF command and immediately enter a LOGON command to start a new session.
• Start a new session with a LOGON command without explicitly entering a LOGOFF command. In this case, ITEQ automatically logs off the existing session.
Interrupting a Session
Under MVS/TSO or VM/CMS, the procedure for interrupting ITEQ differs, depending on whether a user’s terminal is non-SNA (using “A” rules) or SNA (using “B” rules).
To determine whether a terminal is using “A” rules or “B” rules, look for an “A” or a “B” at the extreme lower left-hand corner of the screen. Refer to the terminal’s Problem Determination Guide for additional information for determining which rules a terminal is using.
Under MVS/TSO, the user can interrupt an ITEQ session as follows:
• Non-SNA Terminal
Press the <RESET> key, then press the <PA1> key.
To continue the session, press the <ENTER> key.
• SNA Terminal
Press the <ATTN> key.
To continue the session, press the <ENTER> key.
Under VM/CMS, the user can interrupt an ITEQ session as follows:
• Non-SNA Terminal
Press the <RESET> key and then press the <ENTER> key.
To continue the session, press the <ENTER> key.
• SNA Terminal
Press the <ATTN> key, or use the <RESET> and <ENTER> key sequence.
To continue the session, press the <ENTER> key.
Default Settings
When ITEQ is invoked, several defaults are set for the user. These defaults include:
• Print and disk file definitions
• Terminal screen size
Each of these default settings is discussed next.
Chapter 1: ITEQ ConceptsDefault Settings
20 Interactive Teradata Query Reference
Print and Disk File Definitions
When ITEQ is invoked, a Teradata-supplied startup procedure provides default definitions for several print and disk files (under CMS) or changed data sets to files data sets (under TSO). These files are used by ITEQ to print or store select results.
The user may override the default definitions or define additional files before invoking ITEQ by using the TSO Allocate command or the VM/CMS FILEDEF command. Both commands also may be executed during the ITEQ session to define or redefine files.
Terminal Screen Size
When ITEQ is invoked, a default screen size for an ITEQ session is determined internally for a terminal. Under TSO, this default screen size can be overridden before ITEQ is invoked using the TSO Terminal command.
Terminal screen size for an ITEQ session must be at least 12 lines by 40 characters, and at most 43 lines by 132 characters. If ITEQ does not support a terminal or a modified screen size, an error message is issued at the time ITEQ is invoked and ITEQ terminates.
Screen Format
After the user invokes ITEQ, the ITEQ screen is displayed at the terminal. The ITEQ terminal screen is divided into three areas, shown in Figure 1: the display area, the input area, and the status area.
Chapter 1: ITEQ ConceptsDefault Settings
Interactive Teradata Query Reference 21
Figure 1: 1ITEQ Screen Format
Each area is described in the following paragraphs:
• The display area
The display area, located at the top of the terminal screen, typically occupies the largest area of the screen. The size of this area varies, depending on the type of terminal that is being used and the size of the input area as the user adjusts it.
For a 3278-2 terminal operating under usual conditions, the display area occupies 20 screen lines, as shown in Figure 1-1. For other terminals, the size of the display area is determined by subtracting the size of input and status areas (normally 4 lines) from the total screen size.
In general, the display area is protected from input so that system responses from ITEQ commands and Teradata SQL statements can be displayed. The INPUT command can set the display area for input. Then, the display area is unprotected and the user can enter long Teradata SQL statements, create macros, or modify previously defined macros, views, or statements in the display area.
• The input area
The input area occupies the three screen lines below the display area. This area is typically used for entering ITEQ commands and Teradata SQL statements, and contains an arrow (==>) to indicate its first line.
Display Area (20 lines in this example)
Input Area (3 lines)
Status Area (1 line)
123456789101112131415161718192021222324
==>
Chapter 1: ITEQ ConceptsDefault Settings
22 Interactive Teradata Query Reference
The input area is always set (unprotected) for input. During a terminal session, the user can adjust the size of the input area by using the SET INPUTAREA SIZE command.
• The status area
The status area always occupies one line at the bottom of the terminal screen. It is always in output mode (protected), and is used to display the ITEQ version number, status messages, and system messages. The ITEQ version number is positioned in the far left area of the screen. Status and system messages are positioned to the far right of the area and bracketed by asterisks (***).
Table 1 summarizes the most common status and system messages.
Table 1: ITEQ Status and System Messages
Message Meaning
COMMAND IN PROGRESS ITEQ is processing a command locally or has sent a statement to the Teradata DBS and is awaiting a response.
DATA AVAILABLE. READY FOR COMMAND
More data returned from the last data-generating command or statement (for example, SELECT) is available for viewing or printing.
END OF DATA. READY FOR COMMAND
The display area currently holds the last page of results from a data-generating command or statement.
INCOMPLETE STATEMENT. READY FOR COMMAND
The entered statement is incomplete either because the user forgot to end the statement with a semicolon or there are unbalanced comments, quote strings, or parameters.
READY FOR COMMAND ITEQ is ready to accept a new command or Teradata SQL statement.
Interactive Teradata Query Reference 23
CHAPTER 2
ITEQ Commands and Teradata SQLStatements
This chapter describes how to:
• Enter ITEQ commands and Teradata SQL statements
• Edit Teradata SQL statements
• Examine the results of a statement
Entering Commands and Statements
The user may enter only one ITEQ command or Teradata SQL statement at a time. Each command or Teradata SQL statement must be delimited by a terminating semicolon:
commandkeyword parameters ;statement ;
Commands and statements are typically entered in the input area. Long Teradata SQL statements needed to compose complex queries or to define tables, views, or macros, can be entered in the larger display area when it is set for input. When a request exceeds the size of the input area or display area, ITEQ edit commands allow the user to move backward or forward through the entire request.
ITEQ Edit Control Commands
ITEQ edit control commands allow the user to enter, edit, and execute Teradata SQL statements and macros (discussed later in this chapter). Edit facilities allow the user to:
• Enter input of one or more lines. The number of lines may exceed the display space available on a single screen.
• Modify lines by:
• Inserting or deleting characters in a line
• Inserting or deleting lines
• Splitting or joining lines
• Display selected portions of a statement or macro when either is too long to be displayed on one screen.
Chapter 2: ITEQ Commands and Teradata SQL StatementsInput Area
24 Interactive Teradata Query Reference
• Enter a new command or statement while viewing the processing results of the previous input.
• Display the most recently processed statement or macro for modification.
• Invoke ITEQ edit control commands using program function (PF) keys on the terminal keyboard.
Table 2 summarizes ITEQ edit control commands. Chapter 3 contains a complete description of each ITEQ edit control command.
With the exception of INPUT and SUBMIT, which apply specifically to the display area, edit control commands may be used either in the input area, or in the display area when it is set for input. The area that is being used for input is designated the “edit area.”
Insertion or deletion of characters within a line are terminal keyboard edit functions. The INSERT MODE key allows characters to be inserted before the cursor position. The DEL key deletes the character where the cursor is positioned.
Input Area
When the user enters a command or statement into the input area, the command or statement typically remains there during processing and display of the response in the display area. If a response indicates that the command or statement that produced it is in error or unsatisfactory, the user may edit the command or statement without rekeying the entire input string, and resubmit it for processing.
Table 2: ITEQ Edit Control Commands
Command Function
ADD Adds one blank line to the edit area following the current cursor position.
CLEAR INPUT Clears the input area or the display area (when it is used for input).
DOWN Moves the edit area display down (forward) over the current input string when this string exceeds the size of the current display.
INPUT Sets the display area for input.
JOIN Appends the next line of characters to the cursor position on the current line, overlaying the cursor and erasing any characters to the right of the cursor.
REMOVE Removes the line in the edit area on which the cursor is currently positioned.
SPLIT Creates a new line following the current line and moves characters right of (and including) the cursor to the new line.
SUBMIT Submits a statement that was entered in the display area during input mode.
UP Moves the edit area display up (backward) over the current string when this string exceeds the length of the current display.
Chapter 2: ITEQ Commands and Teradata SQL StatementsDisplay Area
Interactive Teradata Query Reference 25
When the input area is used to enter statements, the user can invoke ITEQ edit and display control commands only by using program function (PF) keys.
After the Teradata Database System (DBS) has accepted and processed a command or statement and displayed the response, the user can enter a new command or statement, whether or not based on the previous response, by keying over the previous command or statement.
The user may erase all lines of the input area statement by pressing the PF5 or PF17 key, assigned to the CLEAR INPUT command.
The cursor is then positioned at the beginning of the input area for the user to enter a new command or statement.
When the user anticipates entering a long Teradata SQL statement or macro that exceeds the three lines normally allotted to the input area, the user can adjust the size of the area using the SET INPUTAREA SIZE command.
Display Area
An alternative to adjusting the size of the input area is to convert the display area for input, and then enter the new input in the display area. The user converts the display area for input by entering the INPUT command in the input area. Thereafter, the user may enter (input) the new statement into the display area.
When the display area is used for input, editing commands may be entered in the input area, potentially freeing the PF keys for other applications. After the statement is entered, the user may press the PF2 or PF14 key, assigned to the SUBMIT command, to submit the statement for processing. PF keys may be used to invoke edit commands for the display area.
After the Teradata DBS has accepted and processed a command or statement, a response is displayed in the display area. This response overwrites the command or statement, which is moved to the input area. The user may re-execute the statement by pressing <ENTER> once. The user may modify the statement before resubmitting it, as follows:
1 Use ITEQ edit facilities to modify the statement in the input area, and resubmit it by pressing <ENTER> once.
2 Enter the SHOW command to display the first page of the statement in the display area, where the statement can then be modified and resubmitted for processing.
While entering or editing a statement in the display area, the user may clear the display area and reset it for output by pressing the PF17 key, assigned to the CLEAR INPUT command. The cursor is then positioned at the beginning of the input area.
Chapter 2: ITEQ Commands and Teradata SQL StatementsExamining Teradata SQL Statement Results
26 Interactive Teradata Query Reference
Examining Teradata SQL Statement Results
ITEQ provides responses on the terminal screen for all commands and statements that are processed, whether in a client system or in the Teradata DBS.
A response for a successfully executed statement includes:
• The type of processing performed (for example, update)
• Status of and statistics about the processing (for example, the number of records updated)
• Processing results (for example, table rows selected)
A response for a statement that is not executed successfully consist of an error message. In either case, the response is displayed in the display area.
The results of ITEQ commands are either explicit or implicit, depending on the command. Explicit response messages are displayed in the display area. Implicit responses are indicated by appropriate changes in screen content (for example, paging backward or forward over results).
Data-Generating Statements
ITEQ retains the result of only the last data-generating macro or statement (for example, SELECT) that is successfully processed. When a new data-generating statement is entered, ITEQ automatically discards the result of the preceding statement. Entry of a non-data-generating command or statement does not usually cause the result of the previous data-generating statement to be discarded.
When a data-generating statement is executed successfully, the result is presented in either Format or Unformat mode, depending upon which output mode is in effect.
In Format mode, used to format data into a report-like presentation, result data is formatted into individual pages. The processing type, status, and statistics are displayed as the first result page.
Result data is displayed on subsequent pages, each of which contains a heading that consists of current date, report title, and page number. Data is displayed according to the format command specifications that are in effect. (Refer to chapter 3, SET DEFAULTS Command, for a discussion of default display controls.)
Pages may be viewed using the ITEQ display control commands listed in Table 3 on page 27.
In Unformat mode, an unformatted result is displayed beginning on the first result page, preceded by processing type, status, and statistics. Subsequent result pages, if any, are displayed without any heading except the processing statistics.
ITEQ Display Control Commands
Display control commands are used to view lengthy results on the terminal screen. For example, if a result is wider than the display screen, display control commands may be used to move the screen right or left over the result up to 512 character positions.
Chapter 2: ITEQ Commands and Teradata SQL StatementsExamining Teradata SQL Statement Results
Interactive Teradata Query Reference 27
Table 3 lists the ITEQ display control commands. Chapter 3 contains a complete description of each display control command.
ITEQ Format Specification Commands
ITEQ format specification commands, listed in Table 4 are used to set format controls for a displayed or printed report. Chapter 3 contains a complete description of each ITEQ format specification command.
Table 3: ITEQ Display Control Commands
Command Function
BACKWARD Moves the display of the result of a Teradata SQL data-generating statement backward from the current page to a previous page.
FORWARD Moves the display of the result of a Teradata SQL data-generating statement forward from the current page to a subsequent page.
LEFT Moves the display area of the screen to the left a specified number of spaces in order to display a statement or macro result that exceeds the width of the display area.
RECALL Causes the last displayed page of selected results to be displayed again.
RIGHT Moves the display area of the screen to the right a specified number of spaces in order to display a statement or macro result that exceeds the width of the display area.
Table 4: ITEQ Format Specification Commands
Command Function
REMARK Used in a macro to supply commentary.
SET DEFAULTS Resets the format specifications to the default values of the ITEQ formatting commands.
SET FORMAT Sets the formatting mode for displaying and printing the selected results.
SET NULL AS Specifies a character to be used in a null field.
SET PAGELENGTH Defines the maximum number of lines in a printed page of a result.
SET PROGRAM FUNCTION KEY Assigns an ITEQ command to a specified program function key.
SET RTITLE Specifies a title that appears in the heading of each page of a displayed or printed report.
SET SUPPRESS Specifies whether consecutive repeating values from a selected result are to be printed as displayed.
SET WIDTH Sets the maximum line width for a printed page.
Chapter 2: ITEQ Commands and Teradata SQL StatementsExamining Teradata SQL Statement Results
28 Interactive Teradata Query Reference
The user can print the data generated by a statement at any time before the data is discarded with the PRINT command. The Teradata DBS formats result pages created in Format mode according to the most recently defined format specifications. The system prints data pages created in Unformat mode as they were displayed on the terminal screen, adjusted to page length and line width specifications.
A user can also file the data generated by a statement using the FILE command, which creates a client flat file. The flat file format contains no headings, spacing, or summary (subtotals or totals) results for selected column data.
ITEQ System Control Commands
System Control commands are used to control an ITEQ session. When the user enters a System Control command, ITEQ displays a message that indicates success or failure of the command. Table 5 lists the system control commands. Chapter 3 contains a complete description of each ITEQ system control command.
ITEQ Reference Display Commands
Reference display commands are used to display information about current tables and macros, as well as ITEQ control information. The reference display commands are listed in Table 6. Chapter 3 contains a complete description of each ITEQ reference control command.
Table 5: ITEQ System Control Commands
Command Function
ABORT Terminates a Teradata SQL statement that is in process.
CANCEL Discards the result of the preceding SELECT statement or macro execution. Preceding results are normally discarded when a new data-generating statement or macro is entered.
FILE Creates a client file containing the result of the current data-generating statement.
LOGOFF Terminates an ITEQ session on the Teradata DBS.
LOGON Establishes an ITEQ session on the Teradata Database system.
PRINT Sends the result of the current SELECT statement or macro to the printer. For each print command executed, one copy of a result is printed.
QUIT Terminates the Teradata Database system session and exits ITEQ.
Chapter 2: ITEQ Commands and Teradata SQL StatementsProgram Function Keys
Interactive Teradata Query Reference 29
Program Function Keys
Program Function keys (referred to as PF keys) can be used to invoke frequently used ITEQ commands. When the input area is used for editing input strings, the user must use PF keys to execute ITEQ edit and display control commands.
The SET PFn command may be used to assign a specified ITEQ command to a PF key. For example, executing the command:
SET PF1 ’JOIN;’;
assigns the JOIN command to the PF1 key. When the user presses PF1, the JOIN command is executed.
The user may use the SET PFn command to assign ITEQ commands to PF keys by:
• Executing a SET PFn command anytime during an ITEQ session.
• Executing a macro that contains SET PFn commands during an ITEQ session.
• Defining a startup string that automatically sets PF key assignments at logon.
(Refer to SQL Data Definition Language for information on the Teradata SQL CREATE USER and Teradata SQL MODIFY USER statements.) If PF key assignments are not explicitly made by the user, ITEQ sets default assignments during logon. The default PF key assignments are listed in Table 7.
Table 6: IITEQ Reference Display Commands
Command Function
SHOW Displays the last Teradata SQL statement that was successfully entered and sets the display area to input mode.
SHOW CONTROL Displays the current values of all ITEQ format controls and PF key assignments.
SHOW MACRO, VIEW, or TABLE Displays the definition of a macro, view, or table.
Table 7: Default PF Key Assignments
PF Key Command
PF1 and PF13 SHOW
PF2 and PF14 SUBMIT
PF3 and PF15 ADD
PF4 and PF16 PRINT
PF5 and PF17 CLEAR INPUT
PF6 and PF18 REMOVE
Chapter 2: ITEQ Commands and Teradata SQL StatementsUsing Macros in ITEQ
30 Interactive Teradata Query Reference
During an ITEQ session, the user may check the current PF key assignments by entering the SHOW CONTROL command. This command displays the current values of all PF key assignments and ITEQ format controls.
Using Macros in ITEQ
A macro can contain one or more Teradata SQL statements and certain ITEQ commands, listed below. A user may:
• Define a macro by entering a Teradata SQL CREATE MACRO statement.
• Execute the macro by entering a Teradata SQL EXECUTE MACRO statement.
• Display an existing CREATE or REPLACE version of a previously defined macro in the display area, use edit control commands to modify the macro, and then replace the existing version by executing the SUBMIT command.
Only the following ITEQ commands can be executed from a macro:
• REMARK
• SET DEFAULTS
• SET FORMAT
• SET NULL
• SET PAGELENGTH
• SET PF
• SET RTITLE
• SET SUPPRESS
• SET WIDTH
ITEQ commands in macros must be embedded in Teradata SQL ECHO statements. For example:
ECHO ’SET WIDTH 72;’;
PF7 and PF19 BACKWARD
PF8 and PF20 FORWARD
PF9 and PF21 UP
PF10 and PF22 LEFT
PF11 and PF23 RIGHT
PF12 and PF24 DOWN
Table 7: Default PF Key Assignments (continued)
PF Key Command
Chapter 2: ITEQ Commands and Teradata SQL StatementsInterrupting Statement Processing
Interactive Teradata Query Reference 31
When the Teradata DBS encounters an ECHO statement during execution, it sends a response parcel containing the character string to the client system. ITEQ then interprets the character string as an ITEQ command. If the character string is not one of the commands acceptable to ITEQ, ITEQ ignores it.
If a macro is executed in Format mode, only the formatted results of SELECT statements contained in the macro are displayed at the user’s terminal. Processing, status, and statistics of individual statements are not displayed.
If a macro is executed in Unformat mode, ITEQ displays the following:
• ITEQ commands executed
• Type of processing performed
• Status and statistics generated
• Unformatted SELECT statement results
For a detailed description of how macros are created, defined, and executed, see Database Administration and SQL Data Definition Language.
Interrupting Statement Processing
You may interrupt ITEQ after a Teradata SQL statement is entered and before processing is completed. An interrupt causes ITEQ to pause, display a menu of choices, and wait for a directive. You may then chose to either continue processing; abort processing; log off the session; or exit ITEQ and return control to the client. Refer to the Interactive Teradata Query User Guide (B035-2452) for more information.
Aborting a Statement
If you want to terminate processing of a Teradata SQL statement after the statement is entered but before processing is completed, execute the ITEQ ABORT command. Refer to the description of the ABORT command later in this manual for more information.
Chapter 2: ITEQ Commands and Teradata SQL StatementsInterrupting Statement Processing
32 Interactive Teradata Query Reference
Interactive Teradata Query Reference 33
CHAPTER 3
ITEQ Command Descriptions
ITEQ is composed of commands which are described alphabetically in this chapter. The structure of an ITEQ command is:
commandkeyword parameters ;
The command string must be terminated with a semicolon.
commandkeyword
Specifies the function of the command. A command keyword is reserved for ITEQ; it may not be used as a symbolic name or as part of such a name. Appendix A contains a complete listing of ITEQ keywords.
parameters
Contain numbers, variable names, strings, special characters, an keywords that define the result of command execution.
Each command description contains:
1 A brief description of the command function.
2 The command form. Defaults are underscored in the syntax format. Braces (“{ }”) indicate a choice; the user must enter one of the options within the braces. Brackets (“[]”) indicate an optional entry.
3 Usage notes describing how the command is used.
4 An example of command usage.
ABORT Command
The ABORT command terminates a Teradata SQL statement that is in process.
Form
ABORT ;
Usage Notes
The ABORT command is used as both a Teradata SQL statement and an ITEQ command. It is interpreted as an ITEQ command if it is entered while the status area indicates “COMMAND IN PROCESS.”
Chapter 3: ITEQ Command DescriptionsADD Command
34 Interactive Teradata Query Reference
To abort an operation that is in process on MVS/TSO:
• Press the RESET/<alt><PA1> keys simultaneously to interrupt processing.
To abort an operation that is in process on VM/SP CMS:
• Press the RESET/ENTER keys or RESET/<alt><PA2> keys to interrupt processing.
Processing is interrupted as indicated by the message “ITEQ ATTENTION HANDLING” in the display area.
While processing is interrupted, the following actions may be taken:
• Enter the ABORT command to terminate the transaction in process.
• Press the ENTER key to continue the interrupted statement.
• Enter the LOGOFF command to end the Teradata Database System (DBS) session.
• Enter the QUIT command to return control to the client.
Execution of the ABORT command has much the same effect as entering the Teradata SQL ROLLBACK (ABORT) statement. That is, it aborts the current transaction and rolls back any affects it may have had on the database. However, the Teradata SQL ROLLBACK statement is used within a macro or a transaction that is processed by a language preprocessor to abort a transaction unconditionally in response to an error condition. The ABORT command, by contrast, is used interactively -- and may not be executed in time to stop a transaction. (Refer to item 3 in the dialogue described in Tables 4-4 and 4-5 of the Interactive Teradata Query User Guide [B035-2452].)
If the statement aborted by the ABORT command is a data definition or data manipulation statement, any change made to the database is backed out. For a Teradata SQL SELECT statement, any result is deleted. Locks on the database that were initiated by the aborted statement are released. (For information on lock types and modes, refer to “Concurrency Control” in Database Administration.)
The simplest way to execute the ABORT command is to press a PF key assigned to the command via a startup string (see the Interactive Teradata Query User Guide [B035-2452] for more information).
Example
To abort a Teradata SQL statement that is in process, enter the ABORT command as follows:
ABORT;
ADD Command
The ADD command adds one blank line to the edit area following the current cursor position in order to insert an input line.
Form
ADD ;
Chapter 3: ITEQ Command DescriptionsBACKWARD Command
Interactive Teradata Query Reference 35
Usage Notes
If the input area is used as the edit area, the ADD command can only be executed by using the PF 15 key or a user-assigned PF key. If the cursor is located outside the edit area when the ADD command is invoked, the command is ignored.
Example
To add one blank line to the edit area following the current cursor position, enter:
ADD;
BACKWARD Command
The BACKWARD command moves the display of the result of a Teradata SQL data-generating statement backward from the current page to a previous page.
Form
where:
*
Displays the first result page. The display pages are reformatted using the latest format definitions.
SKIP
Displays the last page of the result of the previous statement in a multi-statement macro. If the current statement is the first statement of the macro, the first page of the current statement is displayed. If the current statement is a data-generating statement, the first page of the results is displayed.
n
Specifies the number of pages to move backward. The default value is 1. When the number of previous pages is less than n, the first page of the result is displayed.
Usage Notes
When a Teradata SQL data-generating statement or macro returns a lengthy result, ITEQ formats the result into data pages corresponding to the current length of the display area.
BACKWARD *
;
SKIP
1BWD
BWDS
n
Chapter 3: ITEQ Command DescriptionsCANCEL Command
36 Interactive Teradata Query Reference
The BACKWARD command is effective only in the display area when it is in output mode. If the command is entered in the input area, it is erased upon execution. If the command is not accepted, the display is not changed and the cursor is moved to the beginning of the input area.
The abbreviation for BACKWARD SKIP is BWDS.
Examples
To display the previous result page, enter:
BWD ;
To move the screen display back ten pages, enter:
BWD 10 ;
CANCEL Command
The CANCEL command discards the result of the previous selection or macro execution. Previous results are usually discarded when the next data-generating statement or macro is encountered.
Form
CAN[CEL] ;
Usage Notes
When the CANCEL command is entered, ITEQ notifies the Teradata DBS, which then discards the current spool file for the session. Use of this command avoids the overhead of maintaining a potentially large spool file that is no longer needed.
Example
To discard the result of the previous operation, enter:
CAN;
CLEAR INPUT Command
The CLEAR INPUT command clears the input area or the display area, when it is used for input.
Form
CLEAR INPUT ;
Chapter 3: ITEQ Command DescriptionsDOWN Command
Interactive Teradata Query Reference 37
Usage Notes
The CLEAR INPUT command may be used to:
• Remove the statement that is currently entered in the input area so that a new statement or command may be entered there.
• Remove a statement that is currently being entered or edited in the display area. The display area is reset for output and the cursor positioned to the beginning of the input area.
The CLEAR INPUT command is assigned to the PF5 or PF17 key.
Example
To clear the input area, enter:
CLEAR INPUT;
DOWN Command
The DOWN command moves the edit area display down (forward) over the current input string when this string exceeds the size of the current display.
Form
where:
n
Specifies the number of lines the edit area is to be moved. The default is 3.
Usage Notes
Either the input or display area can be used as the edit area. Often the number of lines in an input string exceeds the number of lines available in the edit area display. When the input string is longer than the input area, the DOWN command is used to generate additional lines for entering commands. The DOWN command moves this window down over the input.
The DOWN command is not effective when the last line of the input string is the first line in the edit area (that is, the end of the input string is reached).
If the input area is the edit area, the DOWN command can only be executed by PF 24 key, or a user-assigned PF key.
n
3
DO[WN] ;
Chapter 3: ITEQ Command DescriptionsFILE Command
38 Interactive Teradata Query Reference
Examples
To move the edit area down 2 lines, enter:
DO 2;
To move the edit area down 3 lines (the default), enter:
DO;
FILE Command
The FILE command creates a client file that contains the results of the current data-generating statement.
Form
FILE [name] ;
where:
name
Specifies the name of the client file used for storing the statement result. The default filename is ITEQDSK1.
Usage Notes
When a result is filed, a client flat file that contains selected records is established. The records are stored in record mode, that is, in client computer format.
Before logging on to ITEQ, the user may associate names with these files using TSO ATTRIBUTE/ALLOCATE commands or the CMS FILEDEF command. The logical record limit of each flat file is 32,760 bytes.
Files must be able to accept variable-length records. If members changed data set to file of a partitioned file are used, file names must be fully qualified.
When a character constant is retrieved from a client file, the character constant is treated as a variable-length string, which appends the constant with a two byte field. To select a fixed-length character constant, a user may include a character data type phrase in the SELECT statement. For example, the character data type phrase in the following SELECT statement causes the character constant ‘First’ to be returned as a fixed-length string:
SELECT ..., First CHAR(5) FROM expr [expr... ,expr];
See Database Administration for additional information on data attributes.
Example
To store the results of the current data-generating statement in a file named ITEQDSK8, enter:
FILE ITEQDSK8;
Chapter 3: ITEQ Command DescriptionsFORWARD Command
Interactive Teradata Query Reference 39
FORWARD Command
The FORWARD command moves the resulting display of a Teradata SQL data-generating statement forward from the current page to a subsequent page.
Form
where:
SKIP
Displays the last page of the result of the next statement in a multi-statement macro.
• If the current statement is the last statement of the macro, the last page of the current statement is displayed.
• If the current statement is a data-generating statement, the first page of results is displayed.
n
Specifies the number of pages to move forward. The default value is 1. When the number of pages remaining is less than n, the last page of the result is displayed.
Usage Notes
When a Teradata SQL data-generating statement or macro returns a lengthy result, ITEQ formats the result into data pages corresponding to the current length of the display area.
The FORWARD command is effective only in the display area when it is in output mode. If the command is entered in the input area, it is erased upon execution. If the command is not accepted, the display is not changed, and the cursor is moved to the beginning of the input area.
The abbreviation for FORWARD SKIP is FWDS.
Examples
To position the screen forward one page, enter:
FWD;
To position the screen to the first page of the next Teradata SQL statement, enter the FORWARD SKIP command as follows:
FWDS;
FORWARD
;
SKIP
1FWD
FWDS
n
Chapter 3: ITEQ Command DescriptionsINPUT Command
40 Interactive Teradata Query Reference
INPUT Command
The INPUT command sets the display area for input.
Form
INPUT ;
Usage Notes
When the INPUT command is entered, the display and input areas are cleared and the cursor moves to the beginning of the display area. The display area then becomes the edit area where statements can be entered. Acceptable commands from the input area or through PF keys are limited to ITEQ edit control commands and the SHOW, LOGOFF, and QUIT commands. ITEQ ignores any other command.
If the CLEAR INPUT command is entered before a statement i completed, the display area is cleared and reset to output mode.
The cursor is positioned at the beginning of the input area.
Example
To clear the display and input areas and move the cursor to the beginning of the display area, enter:
INPUT;
JOIN Command
The JOIN command joins the current line with the next line at the cursor position.
Form
JOIN ;
Usage Notes
The JOIN command operates according to the current cursor location in the edit area. If the line resulting from the join is too long to fit onto the current line, the extra characters are wrapped around to the next line.
The JOIN command may be entered in the input area and executed at the cursor position in the display area, as described in the example below. However, it is normally more convenient to assign a PF key to the command.
The JOIN command complements the SPLIT command.
Chapter 3: ITEQ Command DescriptionsLEFT Command
Interactive Teradata Query Reference 41
Example
To join two lines, enter the JOIN command in the input area, position the cursor at the point in the line where the join is to occur, then press the ENTER key. The JOIN command is entered as follows:
JOIN;
LEFT Command
The LEFT command moves the display area of the screen to the left a specified number of spaces. Typically, the LEFT command is used to display a statement or macro result that exceeds the width of the display area.
Form
where:
n
Specifies the number of spaces the display is to be moved. The default value is 52.
Usage Notes
The LEFT command is effective only in the display area when it is in output mode. The display area is used as a window for viewing the result of a statement or macro. The LEFT command moves this window to the left to view columns of a wide result that previously were not visible.
If the LEFT command is entered in the input area, data in the input area is erased upon execution. If the command is not accepted, the display is not changed and the cursor is moved to the beginning of the input area. When the leftmost character of the display is reached, ITEQ ignores the LEFT command.
Example
To move the screen 5 positions to the left, enter:
LE 5;
LOGOFF Command
The LOGOFF command logs off an ITEQ session but does not terminate ITEQ.
Form
LOGOFF ;
Chapter 3: ITEQ Command DescriptionsLOGON Command
42 Interactive Teradata Query Reference
Usage Notes
If a LOGOFF command is entered while a transaction is in process (that is, a BEGIN TRANSACTION statement has been entered but an END TRANSACTION statement has not), the transaction is aborted and all affected tables are returned to the state before the BEGIN TRANSACTION statements. See SQL Data Manipulation Language (B035-1146) for additional information about the BEGIN/END TRANSACTION statements.
The following events occur at LOGOFF:
• Outstanding locks for the user are released.
• Any spool file containing the result of a SELECT statement is released.
Example
To log off ITEQ, enter the LOGOFF command as follows:
LOGOFF;
ITEQ responds with a message such as:
Logoff completed. Use “QUIT;” to exit ITEQ.
The user can also enter QUIT to log off the ITEQ session and return terminal control to TSO or CMS.
LOGON Command
The LOGON command establishes an ITEQ session on the Teradata DBS.
Form
LOG[ON] [[tdpid/]username];PASSWORD ==>password[, ’acctid’] [;]
where:
tdpid
Specifies an identifier assigned to a Teradata Director Program (TDP) in a client computer. The identifier has a value between 0 and 9, inclusive. If not entered, the parameter selects the tdpid established for the user by the system administrator (the default). If a tdpid is not specified in the LOGON command, ITEQ responds with the message:
Enter [tdpid/] username onlyusername
Specifies the user’s identification. A username may contain up to 30 characters. If username is not specified, ITEQ responds with the USERNAME ==> prompt and the message:
Enter username onlypassword
Chapter 3: ITEQ Command DescriptionsLOGON Command
Interactive Teradata Query Reference 43
Specifies the password associated with the username. A password may contain up to 30 characters. The password is entered at the PASSWORD ==> prompt. ITEQ displays the message:
Enter password [,’acctid’];’acctid’
Specifies an account identifier associated with the username. When omitted, the default account identifier is used. The account identifier is defined when the user is created. An account identifier may contain up to 30 characters. The acctid is entered at the PASSWORD ==> prompt after the password, if it is required.
Usage Notes
The LOGON command is the first Teradata SQL access command entered after ITEQ is invoked. If a session is already logged on when the current LOGON is issued, the previous session is automatically logged off, and ITEQ prompts for a new username and password. Note that ITEQ control commands may be entered before the LOGON command.
To protect the security of the user’s password and account identifier during logon, the password and account identifier are not displayed on the terminal screen.
The user can log on by specifying only a tdpid as follows:
LOGON [tdpid/] ;
If the tdpid is accepted, ITEQ clears the input area and issues a prompt for the username:
USERNAME ==>
The username can be optionally followed by a semicolon (;) or a comma (,).
If the logon string is accepted, ITEQ clears the input area, and issues a prompt for the password:
PASSWORD ==>
The acctid is entered at the PASSWORD ==> prompt after the password, if it is required.
If any parameter is entered incorrectly, the logon fails, and ITEQ returns an error message. If the tdpid is not provided, ITEQ assumes the user is using a predefined default tdpid (if this is the first logon). If the user has been logged on, ITEQ uses the last valid tdpid as the default. In this case, it prompts the user for the username or password. ITEQ expects the user to type the username, but it also accepts the tdpid if it was not provided with the LOGON command.
When the LOGON command is entered, any startup string set when the user was created is invoked automatically. When the logon is accepted by the Teradata DBS, a message is displayed in the display area, the logon entry is erased from the input area, and the cursor is positioned at the beginning of the input area.
At some Teradata DBS installations, a user may log on by simply entering the LOGON command with a valid username and no password. The ability to logon in this manner is usually determined by the installation’s System Administrator.
Chapter 3: ITEQ Command DescriptionsPRINT Command
44 Interactive Teradata Query Reference
The user may start ITEQ and log on to the Teradata DBS by entering only one command:
• Under TSO:
ITEQ LOGON (’[tdpid/] userid’)
• Under CMS:
ITEQ [tdpid/] userid
By including this command in the user’s TSO STARTUP CLIST or CMS PROFILE EXEC, the user may automatically start ITEQ and log on to the Teradata DBS when logging on to the client computer.
Example
To establish a session with the Teradata DBS, user Inglis enters the LOGON command:
LOGON Inglis;PASSWORD ==> Clark, ’dept500’
After the user enters the first part of the LOGON command, ITEQ prompts for the password. Note that the password is not displayed on the screen for security reasons. The account identifier (acctid) is entered on the same line as the password.
If the logon is accepted, ITEQ displays a message informing the user that the logon was successful.
PRINT Command
The PRINT command prints the result of a SHOW command that is displayed in the display area, or the displayed result of the current data-generating statement.
Form
PRINT [name] ;
where:
name
Specifies the name of the client output file that is to receive the printed results. The default ddname is ITEQPRT1.
Usage Notes
Results of the SHOW command print prior to the current data-generating statement result. Each PRINT command execution prints one copy of a result.
After the PRINT command is executed, ITEQ performs the following actions:
• Sends a rewind command to the Teradata DBS, requesting the Teradata DBS to rewind the spool file containing the results.
• Selects all data sequentially from the beginning of the file, and sends it to the output file.
Chapter 3: ITEQ Command DescriptionsQUIT Command
Interactive Teradata Query Reference 45
• When the print output file is cleared, the result data is sent to a printer and printed immediately according to the format specifications that are in effect when the PRINT command is executed.
Before ITEQ is invoked, the name of an output file for storing spooled results may be defined. Records for these files must contain an extra character space for the ASCII print control characters.
For example, if a print line width of 80 characters is expected, the LRECL parameter used should be 85 for variable length records. This provides one byte for printer control characters and four bytes for the record descriptor word. The maximum size of each print line is limited to 254 characters.
If a print output file is not defined, the default system output file (ITEQPRT1) is used. Output data is diverted to the job entry subsystem, and must later be transcribed to a final output device through TSO/CMS commands.
Example
To send a selected result to the output file defined using the name ITEQPRT3, enter:
PRINT ITEQPRT3;
To obtain a printed copy of SHOW results, enter the SHOW command followed by a PRINT command, as follows:
SHOW MACRO xyz;PRINT ;
In this case, the results are output to the ITEQPRT1 file.
QUIT Command
The QUIT command terminates a Teradata DBS session.
Form
QUIT ;
Usage Notes
If a session is still logged on when the QUIT command is issued, the session is logged off.
Example
To terminate a Teradata DBS session, enter the QUIT command as follows:
QUIT;
Chapter 3: ITEQ Command DescriptionsRECALL COMMAND
46 Interactive Teradata Query Reference
RECALL COMMAND
The RECALL command causes the last displayed page of selected results to be displayed again.
Form
RECALL ;
Usage Notes
The RECALL command is often used to redisplay the most recently displayed page of a selection result that is erased from the display area because another statement is entered.
Example
To cause the last displayed page of selected results to be displayed again, enter:
RECALL;
REMARK Command
The REMARK command is used to include a maximum of three lines of commentary in a macro.
Form
where:
string
Specifies a phrase or message to be displayed. The message can contain up to 255 characters.
Usage Notes
The REMARK command supports three lines of commentary. The command is used primarily to remark on the macro in which it resides.
The REMARK command is bracketed within a Teradata SQL ECHO statement. The sequence // is used to identify the beginning of a second or third line. The total length of the REMARK string, including // separators, cannot exceed a maximum of 255 characters.
The REMARK command can be executed within a macro.
REMARK
RMK'string' ;
Chapter 3: ITEQ Command DescriptionsREMOVE Command
Interactive Teradata Query Reference 47
Example
To display the remark “Employee Table Updated” on the terminal, include the following statement as part of a macro:
ECHO “RMK ’Employee Table Updated’ ;” ;
REMOVE Command
The REMOVE command removes the line in the edit area on which the cursor is currently positioned.
Form
REM[OVE] ;
Usage Notes
When the REMOVE command is entered, lines that follow the removed line move up one line position. The first line of any following page becomes the last line of the current page in the edit area display.
If the input area is used as the edit area, the REMOVE command can only be executed using the PF18 key, or a user-assigned PF key. If the cursor is located outside the edit area when the command is entered, it is ignored.
Example
To remove the line in the edit area on which the cursor is currently positioned, enter:
REM;
RIGHT Command
The RIGHT command moves the display area of the screen to the right a specified number of spaces. The RIGHT command is primarily used to display a statement or macro result that exceeds the width of the display area.
Form
n
52
RI[GHT] ;
Chapter 3: ITEQ Command DescriptionsSET DEFAULTS Command
48 Interactive Teradata Query Reference
where:
n
Specifies the number of spaces the display is to be moved. The default value is 52.
Usage Notes
The RIGHT command applies only to the display area when it is in output mode. The display area is used as a window for viewing the result of a statement or macro. The RIGHT command moves this window to the right to view columns of a wide result that previously were not visible.
If the RIGHT command is entered in the input area, data in the input area is erased upon execution. If the command is not accepted, the display is not changed, and the cursor is moved to the beginning of the input area. When the rightmost character of the display is reached, the command is ignored.
Example
To move the screen 5 positions to the right, enter:
RI 5;
SET DEFAULTS Command
The SET DEFAULTS command resets the format specifications to the default values of the ITEQ formatting commands.
Form
Usage Notes
The ITEQ format specification command defaults are listed in Table 8.
[SET] DEFAULTS
SD[ ; ]
Table 8: Format Command Defaults
Format Command Default
SET FORMAT Unformat mode
SET NULL AS blank
SET PAGELENGTH 55 lines
SET RTITLE 60 characters of first statement line
Chapter 3: ITEQ Command DescriptionsSET FORMAT Command
Interactive Teradata Query Reference 49
If the SET DEFAULTS command is used in a macro, the command is placed in an ECHO statement that may occur anywhere in the macro. Thus, it is possible to reset the formatting mode and to set defaults at any point in the macro.
The SET DEFAULTS command can be executed within a macro.
Example
To reset format specifications to their default values, enter:
SD;
SET FORMAT Command
The SET FORMAT command sets the format mode for selected results which are displayed or printed.
Form
Usage Notes
When a data-generating statement is executed successfully, the result is presented in one of two forms, depending on the output mode (Format or Unformat) that is in effect.
FORMAT ON sets Format mode. In Format mode, processing type, status, and statistics are presented in the display area as the first page. Any data selected is formatted into data pages, each containing date, page number, report title, and column headings, according to specifications set by the format commands. The abbreviation for SET FORMAT ON is SFO.
FORMAT OFF sets unformat mode. When entering ITEQ, it is the default value. In Unformat mode, processing type, status, statistics, and selected data with column headings are displayed as one entity.
SET SUPPRESS
OFF OFF ALL
SET WIDTH 132 characters
Table 8: Format Command Defaults (continued)
Format Command Default
[SET] FORMAT
;
ON
OFF
SFO
SFF
Chapter 3: ITEQ Command DescriptionsSET INPUTAREA SIZE Command
50 Interactive Teradata Query Reference
A result exceeding the size of one display area is viewed as consecutive screen pages without headings, date, page numbers, or report titles. The abbreviation for SET FORMAT OFF is SFF.
The SET FORMAT command can be executed within a macro. If the SET FORMAT command is used in a macro, the command is placed in an ECHO statement that may occur anywhere in the macro.
Therefore, it is possible to set Format mode on and off within the same macro.
Examples
To format output according to the formatting specifications currently in effect, enter the SET FORMAT ON command as follows:
SFO;
To produce unformatted output, enter the SET FORMAT OFF command as follows:
SFF;
SET INPUTAREA SIZE Command
The SET INPUTAREA SIZE command resets the size of the input area.
Form
where:
n
Specifies the number of lines for the screen input area screen. The default value is 3.
Usage Notes
The size of the input area can be modified any time during a session and changes immediately whenever another SET INPUTAREA SIZE command is entered. The minimum allowable size for the input area is one line. When modifying the input area size, allow for at least ten lines in the display area. Ten lines is the minimum number required to display the result of one selected row in format mode.
A selection result in the display area at the time the command is entered remains formatted according to its original display area size until the user rewinds its spool file by executing a BACKWARD * command.
[SET] INPUTAREA SIZE;
n
3
SIS
Chapter 3: ITEQ Command DescriptionsSET NULL AS Command
Interactive Teradata Query Reference 51
Example
To increase the input area size to 6 lines, enter the SET INPUTAREA SIZE command as follows:
SIS 6;
SET NULL AS Command
The SET NULL AS command specifies a character string to be displayed when no value is entered in a column.
Form
where:
string
Specifies a character string. The default value is a blank.
Usage Notes
A result column field that has no value is called a “null field.” The SET NULL AS command specifies a character that appears in such a field in place of the default blank. The default or null character specified during a session remains in effect until another SET NULL command or a SET DEFAULTS command is issued.
The SET NULL command can be executed within a macro.
Example
To specify a question mark as the null character, enter:
SNA ’?’;
[SET] NULL [AS]
SNA'string' ;
Chapter 3: ITEQ Command DescriptionsSET PAGELENGTH Command
52 Interactive Teradata Query Reference
SET PAGELENGTH Command
The SET PAGELENGTH command defines the maximum number of lines on a printed page of a result.
Form
where:
n
Specifies the number of lines. The minimum value for the number of lines is 1. The default value is 55.
Usage Notes
The default length for result pages printed during a session, or for one established during a session, remains in effect until another SET PAGELENGTH command or a SET DEFAULTS command is entered. The result page length for a terminal display is determined by the size of the display area.
The SET PAGELENGTH command can be executed within a macro.
Example
To print 50 lines per result page, enter:
SPL 50;
SET PROGRAM FUNCTION KEY Command
The SET PROGRAM FUNCTION KEY command assigns an ITEQ command to a specified PF key.
Form
[SET] PFn ’command;’ ;
where:
n
Specifies the number of the PF key. Table 9 lists default PF key values.
[SET] PAGELENGTH;
n
SPL 55
Chapter 3: ITEQ Command DescriptionsSET PROGRAM FUNCTION KEY Command
Interactive Teradata Query Reference 53
Command
Specifies the ITEQ command that is entered when the PF key is pressed.
Usage Notes
The SET PROGRAM FUNCTION (PF) KEY command enables a user to enter an ITEQ command by pressing a specified program function key.
PF keys can be set to any ITEQ command. PF key assignment can be cancelled by assigning a null string (two consecutive apostrophes) to the key. Any assignment established during a session is valid only for that session.
During logon, PF key assignments can be established automatically for a user session by including SET PFn commands in the startup macro (referred to as startup string) created during the CREATE USER process. The commands are bracketed within Teradata SQL ECHO statements. For more information on startup strings, refer to the discussion of the CREATE USER statement in the Teradata DBS Reference Manual.
The current PF key assignments can be displayed by entering the SHOW CONTROL command. See the SHOW CONTROL command for more information.
The SET PF command can be executed within a macro.
Table 9: Default PF Key Assignments
PF Key Assignments
PF1 and PF13 SHOW
PF2 and PF14 SUBMIT
PF3 and PF15 ADD
PF4 and PF16 PRINT
PF5 and PF17 CLEAR INPUT
PF6 and PF18 REMOVE
PF7 and PF19 BACKWARD
PF8 and PF20 FORWARD
PF9 and PF21 UP
PF10 and PF22 LEFT
PF11 and PF23 RIGHT
PF12 and PF24 DOWN
Chapter 3: ITEQ Command DescriptionsSET RETLIMIT Command
54 Interactive Teradata Query Reference
Example
To set the PF23 key to the UP command and specify three lines, enter:
SET PF23 ’UP 3;’;
SET RETLIMIT Command
The SET RETLIMIT command is used to limit the amount of a selected result that is returned to the client.
Form
where:
n
Specifies the number of rows returned from the Teradata DBS that are printed or placed in the output data set. n must be greater than zero.
Usage Notes
By default, BTEQ prints the entire result of a select operation. When testing format changes or when convenient, the SET RETLIMIT can be used to limit a selected result to a more manageable size.
Example
To limit a selected result to 100 records, the user could specify the SET RETLIMIT command as follows:
SET RETLIMIT 100
To return to standard operation, the user could specify the SET RETLIMIT command as follows:
SET RETLIMIT 0
SET RTITLE Command
The SET RTITLE command specifies a title that appears in the heading of each page of a displayed or printed report.
[SET] RETLIMIT
SRLn ;
Chapter 3: ITEQ Command DescriptionsSET RTITLE Command
Interactive Teradata Query Reference 55
Form
where:
string
Specifies the title of a report. The title can contain up to 254 characters.
Usage Notes
A report title set during a session remains in effect until another new SET RTITLE command or a SET DEFAULTS command is issued. A null string of two consecutive apostrophes erases the report title. If the report title is erased or no report title is set, the first 60 characters of the first line of the data-generating statement is used.
The current date and page number, automatically generated by ITEQ, also appear in a report heading. Date is displayed in yy/mm/dd format, where yy=year, mm=month, and dd=day.
Position of a title on a report page depends on the established line width for a page and the number of lines the user has specified for the title. The sequence // is used to identify the beginning of a second or third line. The total length of the RTITLE string (including // separators) cannot exceed 254 characters.
A blank title is returned by ITEQ if the user enters a SET RTITLE command with one or more blanks (‘ ’) as the title string. The first 60 characters of the Teradata SQL request are returned if the user enters a SET RTITLE command with two consecutive apostrophes (’’) as the title string.
The SET RTITLE command can be executed within a macro.
Examples
To define a title for a company salary report, enter:
SRT ’Fourth Quarter Salary Report’ ;
To include the name of the company in the salary report, create a two-line title by entering:
SRT ’XYZ CORPORATION // Fourth Quarter Salary Report’ ;
To return a blank title, enter:
SRT ’ ’;
To define a title from a macro, include the SET RTITLE command in an ECHO statement as follows:
ECHO ’SRT “Department Salary Report”;’;
[SET] RTITLE
SRT'string' ;
Chapter 3: ITEQ Command DescriptionsSET SESSION CHARSET Command
56 Interactive Teradata Query Reference
SET SESSION CHARSET Command
The SET SESSION CHARSET command sets the name of the character set for the current session. Two views exist in conjunction with this command:
• HostsInfo View
• CharTranslation View
The HostsInfo View defines the default character set for your client. The CharTranslation View defines the character sets available in the Teradata DBS.
Form
[SET] SESSION CHARSET [code|’charstring’]
where:
code
specifies the numeric code for the character set.
charstring
specifies the name of the character set to be used. The name cannot exceed 30 characters and it must be enclosed in either single (’) or double (“) quotes.
HostsInfo View defines the default character set for your client ID.
The default is EBCDIC.
Usage Notes
The .[SET] SESSION CHARSET command specifies the name of the character set to be used for the current session. The character sets are user-definable and defined in the CharTranslations View.
You can choose the character set either by name or by numeric code. It is recommended to enter the character set by name. If selecting by name, the name must exist in the CharSetName column in the CharTranslations View. If selecting by code, the code must exist in the CharSetId column in the CharTranslations View and be in the range of 65 to 126.
The HELP SESSION command displays the current collation and character set of your session. See the example below.
The .[SET] SESSION CHARSET command cannot be used in a Teradata SQL macro.
Example
To change the character set to German during a session, enter the .[SET] SESSION CHARSET command as follows:
.[SET] SESSION CHARSET ’GermanASCII’
Chapter 3: ITEQ Command DescriptionsSET SUPPRESS Command
Interactive Teradata Query Reference 57
For help, enter the following command:
.foldline on all
.sidetitles onhelp session;
BTEQ returns the following information:
*** Help information returned. One row.*** Time was 0.25 second.User Name KLDAccount Name DBCLogon Date 90/08/24Logon Time 16:23:45Current DataBase KLDCollation ASCIICharacter Set GermanASCIIBTEQ -- Enter Teradata SQL request or BTEQ command:
Note: Use .SIDETITLES and .FOLDLINE before entering the HELP SESSION command for a readable format. If a bad character set name or code is given, the error returned from the Teradata DBS is displayed with the next SQL statement. The SQL statement is not executed.
To return to the default character set, enter:
[SET] SESSION CHARSET
SET SUPPRESS Command
The SET SUPPRESS command specifies whether consecutive repeating values from a selected result are to be displayed or printed.
Form
where:
n [,n ,n ...]
Specifies one or more columns in which repeating values are to appear. Columns are numbered left to right starting from 1.
[SET] SUPPRESS
SSF
OFF
;ALLSSO
ON
n [, n, n,...]
Chapter 3: ITEQ Command DescriptionsSET WIDTH Command
58 Interactive Teradata Query Reference
Usage Notes
ALL specifies that repeating values in all columns are to be displayed or printed (OFF), or suppressed (ON) from being displayed or printed.
SET SUPPRESS ON suppresses consecutive repeating values from being displayed or printed. The SET SUPPRESS ON command remains in effect until a SET SUPPRESS OFF or a SET DEFAULTS command is entered. The abbreviation for SET SUPPRESS ON is SSO. The default value for entering the command after logging on to ITEQ is ON ALL.
The SET SUPPRESS command causes a blank line to be displayed where the value in the suppressed column changes.
SET SUPPRESS OFF resets column suppression and allows consecutive repeating values to be displayed or printed. The system default value before logging on to ITEQ is SET SUPPRESS OFF ALL.
The abbreviation for SET SUPPRESS OFF is SSF.
The SET SUPPRESS OFF command may be invoked for one or all columns when a result that was displayed or printed with the SET SUPPRESS ON command in effect indicates a need for repeating column values.
The SET SUPPRESS command can be executed within a macro.
Examples
To print or display repeating values for column 3, enter:
SSF 3;
To suppress repeating values in the first (leftmost) column, enter:
SSO 1;
To suppress all columns, enter:
SSO ;
SET WIDTH Command
The SET WIDTH command sets the maximum line width for a printed page.
Form
where:
n
[SET] WIDTH;
n
SW 132
Chapter 3: ITEQ Command DescriptionsSHOW Command
Interactive Teradata Query Reference 59
Specifies the line width in number of characters. The range for the print line width is 20 to 254 characters. The default value is 132.
Usage Notes
The line width set during a session remains in effect until another SET WIDTH command is entered.
When the result of a selection exceeds the maximum line width specified by n, the following error message is issued:
MAXIMUM LINE WIDTH IS n CHARACTERS (EXCEEDS PRINT LINEWIDTH)
The user may then enter a revised width value to adjust the print width before executing the PRINT command. If the print width is not adjusted, the printed result lines are truncated.
Note that the maximum number of characters for a displayed result line is 512. Result lines exceeding the width of a terminal may be viewed using the RIGHT or LEFT commands.
The SET WIDTH command can be executed within a macro.
Example
To print 60 characters per line, enter:
SW 60;
SHOW Command
The SHOW command displays the last Teradata SQL statement that was entered and sets the display area to input mode.
Form
SHO[W] ;
Usage Notes
If the displayed statement exceeds the size of the display area, the first page is displayed. Subsequent pages may be viewed or modified using ITEQ edit control commands. Acceptable commands from the input area are then limited to the ITEQ edit control commands and the SHOW, LOGOFF, and QUIT commands. ITEQ ignores any other command.
If the PF17 key is pressed before another statement is submitted, the display area is cleared and reset to output mode. The cursor is positioned to the beginning of the input area.
A user can print a copy of SHOW results, while the results are still active in the display area by entering the SHOW command and then the PRINT command.
Chapter 3: ITEQ Command DescriptionsSHOW CONTROL Command
60 Interactive Teradata Query Reference
Example
To display the last Teradata SQL statement that was entered, enter:
SHO;
SHOW CONTROL Command
The SHOW CONTROL command displays the current values of all ITEQ format controls and PF key assignments.
Form
Usage Notes
Before a report is printed, the user can enter the SHOW CONTROL command to display ITEQ format control values. Table 10 lists the ITEQ format controls and their system default values.
SHOW CONTROL;
SC
Table 10: Default ITEQ Format Control Values
Format Control Default Value
Output Format Mode Unformat
Output Report Title ?
Print Page Length 55
Print Line Width 132
Retrieve Limit 0 (no limit)
Null Character blank
Column Suppress OFF for all column(s)
PF1 and PF13 SHOW
PF2 and PF14 SUBMIT
PF3 and PF15 ADD
PF4 and PF16 PRINT
PF5 and PF17 CLEAR INPUT
PF6 and PF18 REMOVE
Chapter 3: ITEQ Command DescriptionsSHOW MACRO VIEW or TABLE Command
Interactive Teradata Query Reference 61
If the display area is not large enough to display the format controls, the user must issue the SHOW CONTROL command repeatedly until the last format control value page is displayed.
The format control commands can be used to change the value of a format control.
Example
To display the current values of all ITEQ format controls and PF key assignments, enter:
SC;
SHOW MACRO VIEW or TABLE Command
The SHOW MACRO, VIEW, or TABLE commands display the definition of the selected macro, view, or table.
Form
where:
objname
Specifies the name of the macro, view, or table. This name must be fully qualified.
PF7 and PF19 BACKWARD
PF8 and PF20 FORWARD
PF9 and PF21 UP
PF10 and PF22 LEFT
PF11 and PF23 RIGHT
PF12 and PF24 DOWN
Table 10: Default ITEQ Format Control Values (continued)
Format Control Default Value
MACRO
VIEW
TABLE objname ;SM
SV
ST
SHOW
Chapter 3: ITEQ Command DescriptionsSPLIT Command
62 Interactive Teradata Query Reference
Usage Notes
The SHOW MACRO, VIEW, and TABLE commands are actually Teradata SQL statements that are processed by the Teradata DBS. The abbreviations “SM”, “SV”, and “ST” are unique to ITEQ.
SHOW MACRO allows the user to view and/or modify the last version of a macro, either in the CREATE MACRO statement form, or in the REPLACE MACRO statement form. The display area is converted to the edit area to display the statement, and any desired changes are made in the edit area. The macro definition may then be replaced with the revised version, using the REPLACE MACRO statement. If no changes are made in the macro, the display can be erased from the screen by pressing the CLEAR INPUT key (PF17) on the terminal. The abbreviation for SHOW MACRO is SM.
SHOW VIEW allows the user to see and/or modify the latest statement that defines a view. The current version of the view may be replaced with a revised version using the REPLACE VIEW statement. If no changes are made in the displayed statement, it can be erased from the screen by pressing the CLEAR INPUT key (PF17) on the terminal. The abbreviation for SHOW VIEW is SV.
SHOW TABLE allows the user to see the present CREATE TABLE statement used to define a table. Although the table definition cannot be replaced, the user may add or delete table columns using the ALTER TABLE statement.
A user can print a copy of SHOW results while the results are still active in the display area by entering the SHOW command and then the PRINT command.
A user can obtain information about the attributes of a specific object contained within a table, view, or macro by entering a HELP statement. (For specific information about the HELP statement, refer to the Teradata SQL Reference Manual.
The abbreviation for SHOW TABLE is ST.
Examples
To display the new employee macro, enter the SHOW MACRO command as follows:
SM Personnel.NewEmp1 ;
To display the CREATE or MODIFY statement for the employee table, enter the SHOW TABLE command as follows:
ST Personnel.Employee ;
SPLIT Command
The SPLIT command breaks the current line at the cursor position and moves characters between the cursor and the end of the current line to the next line.
Form
SPLIT ;
Chapter 3: ITEQ Command DescriptionsSUBMIT Command
Interactive Teradata Query Reference 63
Usage Notes
The SPLIT command operates according to the current cursor location in the display area.
The SPLIT command may be entered in the input area and executed at the cursor position in the display area. However, it is normally more convenient to assign a PF key to the command.
The SPLIT command complements the JOIN command.
Example
To break the current line, enter the SPLIT command in the input area, position the cursor to the point in the line where the break is to occur, then press the ENTER key. The SPLIT command is entered as follows:
SPLIT;
SUBMIT Command
The SUBMIT command submits a statement that was keyed in the display area for execution, and resets the display area to output mode.
Form
SUB[MIT] ;
Usage Notes
The SUBMIT command is entered only after an INPUT or SHOW command is entered and the display area is in input mode. After a Teradata SQL statement is submitted by the SUBMIT command, the statement is redisplayed in the input area. If the statement is not accepted by the Teradata DBS, it may be modified in the input area using edit control commands and resubmitted by pressing the ENTER key on the terminal.
If the SUBMIT command is entered while the display area is in input mode and no statement has been entered there, the display area is reset for output.
Example
To submit a statement that was entered in the display area for execution, enter:
SUB ;
UP Command
The UP command moves the edit area display up over the current input string when this string exceeds the length of the current display.
Chapter 3: ITEQ Command DescriptionsUP Command
64 Interactive Teradata Query Reference
Form
where:
n
Specifies the number of lines that the edit area is to be moved. The default is 3.
Usage Notes
Either the input or the display area can be used as the edit area. Often the number of lines in an input string exceeds the number of lines available in the edit area display. When the input string is longer than the input area, the UP command is used to generate additional lines into which to enter commands. The edit area is used as a window into the input. The UP command moves this window up over the input.
The UP command is not effective when the first line of the input string is the last line in the edit area (that is, the beginning of the input string is reached).
If the input area is the edit area, the UP command can only be executed by PF21 key, or a user-assigned PF key.
Examples
To move the edit area up 2 lines, enter the UP command as follows:
UP 2;
To move the edit area up 3 lines (the default), enter:
UP;
n
3
UP ;
Interactive Teradata Query Reference 65
APPENDIX A
ITEQ Keywords
The keywords in Table 11are reserved for use only in ITEQ commands:
Table 11: ITEQ Keywords
ABORT FORWARD
ADD FWD (for FORWARD)
ALL FWDS (for FORWARD SKIP)
AS INPUT
BACKWARD INPUTAREA
BWD (for BACKWARD) JOIN
BWDS (for BACKWARD SKIP) LE (for LEFT)
CAN (for CANCEL) LEFT
CANCEL LOG (for LOGON)
CLEAR LOGOFF
CMS LOGON
CONTROL NULL
DEFAULTS ON
DO (for DOWN) OFF
DOWN PAGELENGTH
FILE PF
FORMAT PRINT
QUIT SKIP
REM (for REMOVE) SM (for SHOW MACRO)
REMARK SNA (for SET NULL AS)
REMOVE SPL (for SET PAGELENGTH
RECALL SPLIT
RI (for RIGHT) SRT (for SET RTITLE)
RIGHT SSO (for SET SUPPRESS ON)
Appendix A: ITEQ Keywords
66 Interactive Teradata Query Reference
RMK (for REMARK) SSF (for SET SUPPRESS OFF)
RTITLE ST (for SHOW TABLE)
SC (for SHOW CONTROL) SUB (for SUBMIT)
SD (for SET DEFAULTS) SUBMIT
SET SUPPRESS
SFF (for SET FORMAT OFF) SV (for SHOW VIEW)
SFO (for SET FORMAT ON) SW (for SET WIDTH)
SHO (for SHOW) TSO
SHOW UP
SIS WIDTH
SIZE
Table 11: ITEQ Keywords (continued)
ABORT FORWARD
Interactive Teradata Query Reference 67
APPENDIX B
Notation Convention
Language elements for the Teradata Database System (DBS) are described in a uniform manner throughout this reference manual. The format is designed to assist the user in understanding statement and command syntax.
Table 12 contains a summary of syntax formats.
Table 12: Format Notations
Convention Example Meaning
Uppercasecharacters
ADD Indicate keywords. Keywordsmay be entered in uppercase ormixed case. In this manual,keywords are always shown inuppercase.
Underscores Indicate the default value.
Specialcharacters
, ( ) ; = Used as shown unlessotherwise indicated. (Thisincludes blanks.)
Braces Indicate a mandatory choice.One of the parameters withinthe braces must be entered.
Brackets Indicate an optional entry. If two or more parameters are listed, one one can be specified.
Horizontalellipsis
[ n [, n, n, ...] ] Indicates that the phrase can berepeated.
Verticalellipsis
...
Indicates omitted portions in astatement or a command.
ONOFF
MACROVIEWTABLE
[ n [, n, n, ...] ]
SKIP
1n
Appendix B: Notation Convention
68 Interactive Teradata Query Reference
Interactive Teradata Query Reference 69
APPENDIX C
Sample Personnel Database
On the following page is a representation of the sample personnel database referred to in this manual.
Appendix C: Sample Personnel Database
70 Interactive Teradata Query Reference
CR
EA
TE
TA
BL
E pe
rson
nel.p
roje
ct ,F
AL
LBA
CK
,
Proj
_Id
CHA
R(8
) TIT
LE ?
Proj
ect//
Id?
NO
TN
ULL
,
CR
EA
TE
TA
BL
E pe
rson
nel.d
epar
tmen
t ,FA
LLB
AC
K ,
Dep
tNo
SMA
LLIN
T FO
RM
AT
?999
?BE
TWEE
N 1
00 A
ND
900
NO
T N
ULL
,
Des
crip
tion
VA
RC
HA
R(25
) TIT
LE ?
Proj
ect D
escr
iptio
n?,
Rec
Dat
e D
ATE
TIT
LE?R
ecei
ved/
/Dat
e?,
Due
Dat
e D
ATE
TIT
LE ?
Due
//D
ate?
,C
omD
ate
DA
TE T
ITLE
?C
ompl
//Dat
e?)
UN
IQU
EPR
IMA
RY IN
DEX
( Pro
j_Id
);
Dep
tNam
e V
ARC
HA
R(1
4),
Loc
CH
AR
(3),
Mgr
No
SMA
LLIN
T FO
RM
AT
?9(
5)?
BETW
EEN
100
01 A
ND
320
01 N
OT
NU
LL)
UN
IQU
E PR
IMA
RY
IND
EX( D
eptN
o);
CR
EAT
ET
ABL
Epe
rson
nel.c
harg
es,F
AL
LBA
CK
,
EmpN
oSM
ALL
INT
FOR
MA
T ?9
(5)?
TITL
E ?
Empl
oyee
//Id?
BETW
EEN
100
01 A
ND
320
01 N
OT
NU
LL,
Proj
_Id
CHA
R(8
) TIT
LE ?
Proj
ect//
Id?
NO
T N
ULL
,W
kEnd
DA
TE T
ITLE
?W
eek/
/End
ing?
,H
ours
DEC
IMA
L(4,
1) F
ORM
AT
?ZZ9
.9?
BETW
EEN
0.5
AN
D 9
99.5
)PR
IMA
RY
IND
EX (
EmpN
o ,P
roj_
Id )
IND
EX( P
roj_
Id);
CR
EA
TE T
AB
LE p
erso
nnel
.em
ploy
ee ,F
AL
LBA
CK
,
EmpN
oSM
ALL
INT
FOR
MA
T?9
(5)?
BET
WEE
N 1
0001
AN
D 3
2001
NO
T N
ULL
,N
ame
VA
RCH
AR
(12)
NO
TN
ULL
,D
eptN
o SM
ALL
INT
FORM
AT
?999
? B
ETW
EEN
100
AN
D 9
00,
JobT
itle
VA
RCH
AR
(12)
,Sa
lary
DEC
IMA
L(8,
2) F
OR
MA
T ?Z
ZZ,Z
Z9.9
9?BE
TWEE
N 1
.00
AN
D 9
9900
0.00
,Y
rsEx
p B
YTE
INT
FOR
MA
T ?Z
9? B
ETW
EEN
-99
AN
D 9
9,D
OB
DA
TE F
ORM
AT
?MM
MbD
DbY
YY
Y?
NO
TN
ULL
,Se
x C
HA
R(1
) UPP
ERC
ASE
NO
TN
ULL
,Ra
ce C
HA
R(1)
UPP
ERC
ASE
,M
Stat
CH
AR(
1) U
PPER
CASE
,Ed
Lev
BYTE
INT
FORM
AT
?Z9?
BETW
EEN
0 A
ND
22
NO
T N
ULL
,H
Cap
BY
TEIN
T FO
RM
AT
?Z9?
BET
WEE
N -9
9A
ND
99)
UN
IQU
E PR
IMA
RY
IND
EX (
EmpN
o)
IND
EX( N
ame
);
Tab
le:
Cha
rges
1001
5A
P1-0
001
83/0
2/18
30.5
12.5 4.5
28.0
40.0
10.0
23.0
24.0 5.0
37.0 2.5
30.5
10.5
20.5
32.0
33.0
30.0
10.0
32.0
34.5
53.0
20.0
33.5
12.0
83/0
2/18
83/1
1/18
83/0
2/04
83/1
1/18
83/1
0/07
83/0
3/18
83/0
2/25
83/0
9/30
83/0
4/15
83/0
2/25
83/0
1/21
83/0
2/25
83/0
2/11
83/0
1/14
83/0
8/26
83/0
1/28
83/0
2/18
83/0
5/20
83/1
0/21
83/0
7/29
83/0
1/14
83/0
4/15
83/0
3/11
AR
1-00
02PA
Y-0
001
AR
1-00
03EN
G-0
003
EO1-
0001
OE1
-000
1A
R1-
0002
PAY
-000
1PA
Y-0
001
ENG
-000
3O
E1-0
001
OE1
-000
1A
P1-0
003
ENG
-000
2PA
Y-0
001
OE1
-000
1A
P1-0
002
ENG
-000
2PA
Y-0
002
ENG
-000
2O
E1-0
002
OE1
-000
1O
E1-0
001
1001
010
001
1001
910
004
1001
010
003
1001
510
001
1001
710
016
1001
410
003
1001
910
016
1001
710
014
1001
010
016
1000
110
004
1001
410
002
1000
2
Empl
oyee
Proj
ect
Wee
kId
IdEn
ding
Hou
rs
Tab
le:
Dep
artm
ent
Dep
tNo
Dep
tNam
eLo
cM
grN
o
1001
110
007
1001
210
018
1002
1
NY
CCH
IA
TLN
YC
NY
C
Adm
inist
ratio
nM
anuf
actu
ring
Engi
neer
ing
Exec
Off
ice
Mar
ketin
g
100
600
500
300
700
EmpN
oN
ame
Dep
tNo
JobT
itle
Sala
ryY
rsEx
pSe
xR
ace
MSt
atEd
Lev
HC
ap 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
12 16 16 16 16 12 16 16 16 20 18 20 18 16 16 18 18 16 16 16 12
M M M D M M S M S S M M M M M M W D S S M
C A S B C C C C B C C C A C N A B C A C C
F F M M M M M F F M M M F F M F F M M F M
Aug
29 1
956
Nov
29 1
955
Jul0
9 19
49Ju
n05
193
2A
ug23
194
4Se
p12
194
7M
ar07
193
8Ju
l12
1948
Jul2
9 19
46O
ct03
194
3O
ct31
195
1M
ar12
193
5Ju
n07
194
7O
ct20
194
8N
ov27
195
5Ju
n07
194
7N
ov16
194
5A
pr08
194
9A
pr24
195
4O
ct15
194
7M
ar27
194
2
6 11 11 25 9 7 5 13 10 8 10 20 12 10 15 12 3 4 8 5 5
28,6
00.0
038
,000
.00
45,0
00.0
065
,000
.00
38,0
00.0
029
,000
.00
34,0
00.0
023
,000
.00
45,0
00.0
056
,000
.00
42,0
00.0
044
,000
.00
55,0
00.0
044
,000
.00
32,5
00.0
022
,000
.00
35,0
00.0
030
,000
.00
40,0
00.0
030
,000
.00
25,0
00.0
0
Test
Tech
Con
trolle
rM
anag
erPr
esid
ent
Sale
sper
son
Ass
embl
erTe
ch W
riter
Secr
etar
yM
anag
erV
ice
Pres
Engi
neer
Engi
neer
Vic
e Pr
esPu
rcha
ser
Payr
oll C
kSe
cret
ary
Rec
ruite
rTe
chni
cian
Prog
ram
mer
Sale
sper
son
Payr
oll C
k
600
100
600
300
700
600
500
300
700
500
500
500
300
600
100
500
100
500
500
700
100
New
man
PCh
in M
Agu
ilar J
Russ
ell S
Clem
ents
DK
empe
r RIn
glis
CLe
idne
r PSm
ith T
Wat
son
LSm
ith T
Carte
r JPh
an A
Rega
n R
Gre
ene
WM
arst
on A
Mof
fit H
Reed
CO
mur
a H
Bran
gle
BPe
ters
on J
1001
910
011
1000
710
018
1002
210
006
1001
410
003
1002
110
012
1000
410
016
1000
810
013
1001
710
009
1000
210
010
1001
510
020
1000
1
DO
B
OE1
-000
3O
/E B
atch
Sys
tem
82/1
1/21
83/1
0/27
83/1
0/27
83/0
4/10
83/0
4/10
83/1
0/27
83/0
4/20
83/0
4/10
83/0
4/10
83/0
4/10
83/0
4/10
84/0
1/31
83/1
1/15
78/0
8/08
83/0
4/10
81/0
5/05
83/0
4/21
83/1
0/27
83/1
0/27
83/0
4/21
83/0
4/21
84/0
1/10
83/0
4/10
83/1
1/10
81/1
0/26
78/1
2/06
83/0
4/10
83/0
4/10
83/1
0/27
83/0
4/10
83/0
4/10
83/0
4/10
83/0
4/10
83/0
4/10
83/1
2/31
83/1
0/27
79/0
7/19
83/0
4/10
80/1
0/27
83/0
4/10
83/1
0/27
83/1
0/27
83/0
4/10
83/0
4/10
83/1
2/31
83/0
4/10
83/1
0/27
81/1
0/27
78/1
2/31
82/0
8/09
82/0
8/09
82/1
1/21
82/0
8/09
82/0
8/09
82/0
8/09
82/0
8/09
82/0
8/09
83/0
1/01
82/1
1/21
78/0
1/02
82/0
8/09
78/0
1/02
82/0
8/09
82/1
1/21
82/1
1/21
82/0
8/09
82/0
8/09
83/0
1/01
82/0
8/09
82/1
1/21
81/0
4/10
78/0
1/02
A/P
Paya
ble
Onl
ine
Syste
mA
/R R
ECV
Onl
ine
Syst
emO
/E D
ate
Bas
e D
esig
nA
/R R
ECV
Bat
ch S
yste
mA
/R R
ECV
Dat
eBa
se D
esig
nA
/R R
ECV
Onl
ine
Syst
emA
/PPa
yabl
e D
B D
esig
nA
/PPa
yabl
e B
atch
Sys
tem
Payr
oll F
ile M
aint
enan
ceO
/E B
atch
Sys
tem
Des
ign
Wid
get P
wr S
uppl
yA
/PPa
yabl
e D
B D
esig
nD
esig
n W
idge
t Fra
me
A/P
Paya
ble
Bat
ch S
yste
mO
/E D
ata
Bas
e D
esig
nO
/E O
nlin
e Sy
stem
A/P
Paya
ble
Onl
ine
Syste
mA
/R R
ECV
Dat
eBa
se D
esig
nPa
yrol
l Sys
tem
Dat
a En
tryA
/R R
ECV
Bat
chSy
stem
O/E
Onl
ine
Syste
mA
ssem
ble
And
Tes
t Wid
get
Des
ign
Wid
get B
oard
s
AP2
-000
2A
R1-
0002
OE2
-000
1A
R1-
0003
AR
2-00
01A
R2-
0002
AP2
-000
1A
P2-0
003
PAY
-000
2O
E2-0
003
ENG
-000
2A
P1-0
001
ENG
-000
3A
P1-0
003
OE1
-000
1O
E1-0
002
AP1
-000
2A
R1-
0001
PAY
-000
1A
R2-
0003
OE2
-000
2EN
G-0
004
ENG
-000
1
PER
SON
NE
L D
AT
AB
ASE
NO
BEF
OR
E JO
UR
NA
L,N
O A
FTER
JOU
RN
AL
NO
BEF
OR
E JO
URN
AL,
NO
AFT
ER JO
UR
NA
L
NO
BEF
OR
E JO
UR
NA
L,N
O A
FTER
JOU
RN
AL
NO
BEF
OR
E JO
UR
NA
L,N
O A
FTER
JOU
RN
AL
( (
Tab
le:
Em
ploy
ee
(
Proj
ect
IdPr
ojec
t Des
crip
tion
Rec
eive
dD
ate
Due
Dat
eC
ompl
Dat
e
Tabl
e:Pr
ojec
t
(
Interactive Teradata Query Reference 71
Index
AABORT command 33aborting a statement 31ADD command 34
BBACKWARD command 35
CCANCEL command 36CLEAR INPUT command 36commands
entering 23ITEQ display control commands 26ITEQ edit control commands 23ITEQ format specification commands 27ITEQ reference display commands 28ITEQ system control commands 28
Ddata-generating statements 26default settings 19disk file definitions 20display area 25display control commands 26DOWN command 37
Eentering commands and statements 23
FFILE command 38format specification commands 27FORWARD command 39function keys, program 29
Hhardware requirements 17
Iinput area 24INPUT command 40
in-session logons 19Interactive Teradata Query User Guide 5interrupting a session 19ITEQ commands 23ITEQ edit control commands 23
JJOIN command 40
LLEFT command 41logging off 18logging on 18LOGOFF command 41LOGON command 42
Mmacros, using 30
PPRINT command 44print definitions 20product version numbers 3program functions keys 29
QQUIT command 45
RRECALL command 46reference display commands 28Release Definition 4REMARK command 46REMOVE command 47RIGHT command 47
Sscreen format 20session, interrupting 19SET DEFAULTS command 48SET FORMAT command 49SET INPUTAREA SIZE command 50SET NULL AS command 51
Index
72 Interactive Teradata Query Reference
SET PAGELENGTH command 52SET PROGRAM FUNCTION KEY command 52SET RETLIMIT command 54SET RTITLE command 54SET SESSION CHARSET command 56SET SUPPRESS command 57SET WIDTH command 58SHOW command 59SHOW CONTROL command 60SHOW MACRO VIEW or TABLE command 61software releases
supported 3software requirements 17SPLIT command 62statement processing, interrupting 31statements
aborting 31entering 23
SUBMIT command 63system control commands 28
TTeradata SQL statement, examining results 26Teradata SQL statements 23terminal screen size 20
UUP command 63
Vversion numbers 3