Continuing SQL - Basic Teradata Query

Basic Teradata Query Reference

Product
Basic Teradata Query
Release Number
15.10
Language
English (United States)
Last Update
2018-10-07
dita:id
B035-2414
lifecycle
previous
Product Category
Teradata Tools and Utilities

A Teradata SQL request is automatically continued from one line to the next unless the line ends in a semicolon.

However, the following conditions are excluded:

 

Exceptions for Using Terminating Characters within SQL Requests Example

Example

Semicolon embedded within a comment.

exec /* exec macro current; 
*/macro xyz;

Semicolon embedded in an unsatisfied left parenthesis, single-quote or double-quote pair.

create macro xyz as 
(select * from dbc.tables; 
);
create macro xyz as 
(select ‘abcd;
efgh’; 
);

When a Teradata SQL request is continued from one line to the next, BTEQ translates the line-feed characters at the end of the multi-line SQL requests to carriage-return characters. However, in case of a line-feed appearing inside a quoted string in the request, the line-feed characters are retained as-is.

Example 1: In the following multi-line request, the line-feed character at the end of 1st line will be translated to carriage return:

select 'abcd', 
'efgh';

Example 2: In the following multi-line request, the line-feed character at the end of 1st line will not be translated to carriage return because it is part of a quoted string:

select 'abcd 
efgh';